Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
36Activity
0 of .
Results for:
No results containing your search query
P. 1
Strutur Data Queue c++.cpp

Strutur Data Queue c++.cpp

Ratings: (0)|Views: 2,310 |Likes:
Published by Abdur Rohman M
contoh program struktur data queue.cpp
contoh program struktur data queue.cpp

More info:

Published by: Abdur Rohman M on Nov 15, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/29/2013

pdf

text

original

 
BAB Iqueue.cpp
#include "queue01.h"#include <iostream.h>int array [QUEUE_SIZE];int awal=-1;int akhir=-1;int is_empty(){if ((awal==-1)&&(akhir==-1))return 1;elsereturn 0;}int is_full(){if(akhir==QUEUE_SIZE-1)return 1;elsereturn 0;}void enqueue_item(int item){if(!is_full()){if(awal==-1){awal++;akhir++;}elseakhir++;array[akhir]=item;}elsecout<<"full";}char dequeue_item(void){if(!is_empty()){awal++;cout<<"\n first out"<<endl;}elsecout<<"empty";}void print_item(){if(!is_empty()){for(int i =awal;i<=akhir;i++)cout<<array[i];
 
}elsecout<<"empty";}int main(){int item;cout<<"BAB I, queue."<<endl;int pilih;do{cout<<"\nmenu"<<endl;cout<<"1.add queue"<<endl;cout<<"2.delete queue"<<endl;cout<<"3.print"<<endl;cout<<"4.exit"<<endl;cin>>pilih;switch (pilih){case 1: cout<<"insert new data=";cin>>item;enqueue_item(item); break;case 2: dequeue_item(); break;case 3: cout<<"\nQueue contains"<<endl; print_item();break;case 4: system("cls"); cout<<"\tBye";}}while(pilih<=3);return 0;}
queue01.h
/* Praktikum : QUEUE (antrian) dengan menggunakan array *//* Praktikan mendefinisikan suatu variable global yg bisadimodifikasi dari dalam suatu fungsi *//****************************************//* PROTOTYPE */#define QUEUE_SIZE 5/* Memeriksa apakah suatu Queue kosong? */extern int is_empty(void);/* Memeriksa apakah suatu Queue penuh? */extern int is_full(void);/* Menambahkan suatu item ke dalam queue *//* Kemungkinan error, karena ukuran array sudah penuh */extern void enqueue_item(char item);/* Mengambil suatu item dari dalam queue */extern char dequeue_item(void);/* Mencetak isi queue (dari yang pertama masuk), jika ada */extern void print_item(void);
PrintScreen Program
 
 Menu ProgramDelete empty Queue

Activity (36)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
abdurrohmanm added this note
pake gcc/g++ bawaan linux.
Dedek Charaka added this note
ini pake compiler apa ?? kok di compiler saya gak mau jalan programnya ??
fpangestika liked this
Kairi Selaluada liked this
Agus Banjar liked this
SPutra KLik Gech added this note
Memang harus pake $ ya?? kantong mahasiswa ga mencukupi

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->