MODUL 8 : Queue
Disusun Oleh :
Kristianus Unang
201101018
Dosen :
Yosef Murya Kusuma Ardhana , S.T
Jurusan Sistem Informasi
Sekolah Tinggi Ilmu Komputer
" Yos Sudarso "
Purwokerto
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Laporan Praktikum ( borland edition )
script
#include <iostream.h>
#include <conio.h>
int f,r,df;
int qu[50];
void enQueue(void);
void deQueue(void);
void Tampilkan(void);
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 Anda ( 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;
}
}//End Main/
void enQueue(){
cout<<"Masukkan 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();
}
#include <conio.h>
int f,r,df;
int qu[50];
void enQueue(void);
void deQueue(void);
void Tampilkan(void);
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 Anda ( 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;
}
}//End Main/
void enQueue(){
cout<<"Masukkan 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();
}
screenshoot program
8.1 |
Laporan Praktikum (eclipse edition)
script
//============================================================================
// Name : queue.cpp
// Author : unang
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#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;
}
// Name : queue.cpp
// Author : unang
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#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;
}
screenshoot program
8.1 |
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------