Laporan Praktikum Modul 8 Queue
Disusun oleh :
Novian Adi Prasetyo
201101029
Dosen
Yosef Murya Kusuma Ardhana, S.T
JURUSAN SISTEM INFORMASI
SEKOLAH TINGGI ILMU KOMPUTER (STIKOM)
“YOS SUDARSO”
PURWOKERTO
2012
Menggunakan Program Eclipse
>> Program 8.1
Listing Program :
#include <iostream>
using namespace std;
int f,r,df;
int qu[50];
void enQueue (void);
void deQueue (void) ;
int Tampilkan (void);
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<<"++++++++++++++++++"<<endl;
cout<<endl;
cout<<"Masukan 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;
}
}
void enQueue (){
cout<<" Masukan elemen
: ";
cin>>qu[r];
r++;
}
void deQueue(){
qu[f]=0;
f++;
}
int Tampilkan (){
int i;
cout<<endl<<"Queue :
"<<endl;
for(i=f;i<r;++i)
cout<<qu[i]<<",";
cout<<endl<<"press any
key...";
return 0;
}
Output Program :
Menggunakan Program Borland
>> Program 8.1
Listing Program :
#include <iostream.h>
#include <conio.h>
int f,r,df;
int qu[50];
void enQueue (void);
void deQueue (void) ;
void Tampilkan (void);
void main (){
int k;
for (k=0;k<50;k++)
qu[k]=0;
while (1)
{
clrscr();
cout<<endl;
cout<<"+++++Pilihan++++++"<<endl;
cout<<" 1.
enQueue"<<endl;
cout<<" 2.
deQueue"<<endl;
cout<<" 3. Tampilkan
queue"<<endl;
cout<<"++++++++++++++++++"<<endl;
cout<<endl;
cout<<"Masukan
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;
}
}
void enQueue (){
cout<<" Masukan
elemen : ";
cin>>qu[r];
r++;
}
void deQueue(){
qu[f]=0;
f++;
}
void Tampilkan (){
int i;
cout<<endl<<"Queue :
"<<endl;
for(i=f;i<r;++i)
cout<<qu[i]<<",";
cout<<endl<<"press any
key...";
getche
();
}
Output Program :
Tidak ada komentar:
Posting Komentar