NIM : 201101004
Listing Program
//=======================================================
// Name : Tugas.cpp
// Author : Gatra Mustakim
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//=======================================================
#include <iostream>
#include <cstring>
#include <conio.h>
int r,f,df;
int qu[50];
void enQueue(void);
void deQueue(void);
void Tampilkan(void);
using namespace std;
int main()
{
int k;
for(k=0;k<50;k++)
qu[k]=0;
while(1)
{
cout<<endl;
cout<<"========= Pilihan ==========="<<endl;
cout<<" 1) enQueue "<<endl;
cout<<" 2) deQueue "<<endl;
cout<<" 3) Tampilkan Queue "<<endl;
cout<<" 4) Keluar ! "<<endl;
cout<<"=============================";
cout<<endl;
cout<<" Masukkan pilihan ( 1,2,3,4) dalam melakukan Queue : ";
cin>>k;
if (k==1) enQueue();
if (k==2) deQueue();
if (k==3) Tampilkan();
if (k==4) break;
}
}
//endmain
void enQueue()
{
cout<<" Masukan elemen : ";
cin>>qu[r];
r++;
}
void deQueue()
{
cout<<" Pilihan yang anda pilih adalah Dequeue";
qu[f]=1;
f++;
}
void Tampilkan()
{
cout<<" Pilihan yang anda pilih adalah Tampilkan Queue";
int i;
cout<<endl<<" Queue : "<<endl;
for(i=f;i<r;++i)
cout<<qu[i]<<",";
cout<<endl<<" Pencet Sing Liyane . . .";
}
Tidak ada komentar:
Posting Komentar