Professional Documents
Culture Documents
Screenshoot Aplikasi Dan Code
Screenshoot Aplikasi Dan Code
31160050
1.SOAL ARRAY
#include <stdio.h>
int main()
scanf("%d", &m);
scanf("%d", &n);
printf("Masukkan elemen matriks pertama: \n");
scanf("%d", &matriks1[i][j]);
scanf("%d", &matriks2[i][j]);
printf("\n");
}
return 0;
2. SOAL STACK
#include <iostream>
#include <conio.h>
#include <string>
char maxim=50;
string data[50];
char penunjuk=-1;
bool IsEmpty()
if(penunjuk == -1)
return true;
else
return false;
bool IsFull()
if(penunjuk == maxim-1)
return true;
else
return false;
void push()
if(IsFull())
getch();
else
penunjuk++;
cin.ignore();
void pop()
if (IsEmpty())
getch();
else
penunjuk--;
getch();
void dequeue()
if (IsEmpty())
getch();
else
{
penunjuk--;
getch();
void clear()
penunjuk = -1;
getch();
void view()
if (!IsEmpty())
for(int a=penunjuk;a>=0;a--)
else
{
cout<<"- N U L L -";
//fungsi utama
main()
int jawab;
system ("cls");
cout<<"\t-------------------------------------------------\n";
cout<<"\t-------------------------------------------------\n";
cout<<"\t| |\n";
cout<<"\t| |\n";
cout<<"\t-------------------------------------------------\n";
cout<<"\t| |\n";
cout<<"\t| |\n";
cout<<"\t=================================================\n";
cout<<"\t=================================================\n";
getch();
do
system ("cls");
cout<<endl;
view();
cout<<endl<<endl<<endl<<endl<<endl<<endl;
cout<<"==================== P R O G R A M ELEKTRONIK=====================\n\n";
cout<<"********************************************************************\n";
cout<<"| |\n";
cout<<"| |\n";
cout<<"********************************************************************\n";
cin>>jawab;
switch(jawab)
{
case 1:
int limit;
cin>>limit;
push();
break;
case 2:
pop();
break;
case 3:
dequeue();
break;
case 4:
clear();
break;