Source code:
#include <iostream.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> /*struct Antrian{ char nama[30]; char alamat[30]; char nonpwp[30]; }Loket[3];*/ int x=3; int f=0; int r=0; int pil; void insert() { r+=1; for(int i=r;i<=x;i++) { if(i==x){ cout<<i;}else cout<<i<<"<-"; } cout<<endl<<endl; cout<<"no antrian anda-> "<<r<<endl; } void del() { f=f+1; cout<<"(panggilan) no antrian -> "<<f<<endl; if(f==1){ system("urut1.wma"); }else if(f==2){ system("urut2.wma"); }else if(f==3){ system("urut3.wma"); }else if(f==4){ system("urut3.wma"); } getch(); } void view() { for(int i=f+1;i<=r;i++) { if(i==r){ cout<<i;} else{ cout<<i<<"<-";} } } void clear(){ f=r=-1; } void main() { do { cout<<"=================================\n"; cout<<"\tMENU PROGRAM QUEUE "<<endl; cout<<"=================================\n"; cout<<"1. ambil no antrian "<<endl; cout<<"2. panggil "<<endl; cout<<"3. view "<<endl; cout<<"4. clear "<<endl; cout<<"5. exit "<<endl; cout<<"\n===============================\n"; cout<<"masukan pilihan = "; cin>>pil; switch(pil) { case 1: if(r==x){ cout<<"\n~~antrian penuh~~\n\n"; }else{ insert(); } break; case 2: if(r==-1 || f==r){ cout<<"\n~~tidak ada antrian~~\n\n"; }else{ del(); } break; case 3: if(r==0 && f==0){ cout<<"tidak ada yang di ampilkan\n"; }else{ view();} getch(); break; case 4: clear(); cout<<"data cleared\n"; break; } getch(); }while(pil!=5); }
Untuk lebih jalasnya bi kunjungi di sini
Tidak ada komentar:
Posting Komentar