Coding Program

#include <iostream.h>
#include <conio.h>
#include <stdio.h>

void main(){
int stack[10];
int top=-1;
int pilih, i;
do
{
       gotoxy(25,1);cout<<"********KELOMPOK TIGA********"<<endl;
       gotoxy(25,2);cout<<"-Rizwan Firmansyah\t(12124020)"<<endl;
       gotoxy(25,3);cout<<"-Sugiyono \t\t(12123898)"<<endl;
       gotoxy(25,4);cout<<"-Muslih \t\t(12123362)"<<endl;
       gotoxy(25,5);cout<<"-Yuli Lestari \t\t(12123679)"<<endl;
       gotoxy(25,6);cout<<"-Apiyudin Nasrul \t(12126688)"<<endl;
       gotoxy(25,7);cout<<"-Rokimah \t\t(12126627)"<<endl;
       gotoxy(25,8);cout<<"-Barkah Nur Hikmah \t(12126004)"<<endl;
       gotoxy(25,9);cout<<"-Yudianto \t\t(12125394)"<<endl;
       gotoxy(25,10);cout<<"-Arif Setiawan \t\t(18120941)"<<endl;
       gotoxy(25,11);cout<<"-Winda Handayani \t(12123653)"<<endl<<endl;
       gotoxy(25,12);cout<<""<<endl;
       gotoxy(25,13);cout<<":::::::::::Stack::::::::::::"<<endl;
       gotoxy(25,14);cout<<"============================"<<endl;
       gotoxy(25,15);cout<<"========MENU PILIHAN========"<<endl<<endl;
       gotoxy(25,16);cout<<"============================"<<endl;
       gotoxy(30,17);cout<<" 1. PUSH "<<endl;
       gotoxy(30,18);cout<<" 2. POP "<<endl;
       gotoxy(30,19);cout<<" 3. VIEW "<<endl;
       gotoxy(30,20);cout<<" 4. EXIT "<<endl;
       gotoxy(25,21);cout<<"============================"<<endl;
       gotoxy(25,22);printf("Pilih = "); scanf("%d", &pilih);

switch(pilih) {
case 1://push clrscr();
if (top > 10) printf("Stack penuh!\n");
else
{ printf("Data = "); scanf("%d", &stack[top+1]);
top++;
}
break;

case 2://pop
clrscr();
if (top < 0) printf("Stack kosong!\n");
else
{
printf("Data keluar = %d\n", stack[top]);
top--; }
break;

case 3://view
cout<<"\n\ndata yang ada pada STACK : \n";
{
for(i=top; i>=0; i--) printf("%d ", stack[i]); printf("\n");
}
break;

case 4:
printf("Exit…\n");
break;
}
}while (pilih!=4);
}




Gambar pada saat running .

Created with Artisteer

0 komentar: