SlideShare a Scribd company logo
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#define MAX 6
typedef struct
{
int data[MAX];
int head;
int tail;
}queue;
queue antrian;
void create()
{
antrian.head=antrian.tail=-1;
}
int isempty() {
if(antrian.tail==-1)
return 1;
else
return 0;
}
int isfull() {
if(antrian.tail==MAX-1)
return 1;
else
return 0;
}
void enqueue(int data)
{
if(isempty()==1)
{
antrian.head=antrian.tail=0;
antrian.data[antrian.tail]=data;
printf("%d, Sudah Masuk!",antrian.data[antrian.tail]);
void tampil();
{
int i;
if (isempty()==0)
{
for(i=antrian.head;i<=antrian.tail;i++)
{
printf(" %d ",antrian.data[i]);
}
}
else
printf("n**** QUEUE IS EMPTY ****n");
}
}
else
if(isfull()==0)
{
antrian.tail++;
antrian.data[antrian.tail]=data;
printf("%d , Sudah Masuk!",antrian.data[antrian.tail]);
}
else{
if(isfull()==1)
{
cout<<"nn**** QUEUE IS FULL , data TIDAK dapat masuk ****";
}
}
gotoxy(25,8);cout<<"PRESS any key for back to MENU";
}
int dequeue()
{
if (isempty()==1){
cout<<"n**** ERROR :: QUEUE IS EMPTY ****";
}else
if(isempty()==0){
int i;
int e=antrian.data[antrian.head];
for(i=antrian.head;i<=antrian.tail-1;i++)
{
antrian.data[i]=antrian.data[i+1];
}
antrian.tail--;
cout<<"nnData Yang Keluar => "<<e;
}
gotoxy(25,8);cout<<"PRESS any key for back to MENU";
}
void clear()
{
antrian.head=antrian.tail=-1;
printf("nn**** DATA CLEAR ****");
gotoxy(25,8);cout<<"PRESS any key for back to MENU";
}
void tampil()
{
int i;
if(isempty()==0)
{
cout<<"Data Yang ada Dalam QUEUE : "<<endl<<endl;
for(i=antrian.head;i<=antrian.tail;i++)
{
printf("| %d |",antrian.data[i]);
}
}
else
{
printf("n**** QUEUE IS EMPTY ****n");
}
gotoxy(25,8);cout<<"PRESS any key for back to MENU";
}
void main()
{
int pil;
int data;
create();
do
{
clrscr();
gotoxy(25,2);cout<<"========MENU PILIHAN========"<<endl<<endl;
gotoxy(25,4);cout<<"============================"<<endl;
gotoxy(30,6);cout<<" 1. ENQUEUE "<<endl;
gotoxy(30,7);cout<<" 2. DEQUEUE "<<endl;
gotoxy(30,8);cout<<" 3. TAMPILAN "<<endl;
gotoxy(30,9);cout<<" 4. CLEAR "<<endl;
gotoxy(30,10);cout<<" 5. KELUAR "<<endl;
gotoxy(25,12);cout<<"============================"<<endl;
gotoxy(25,14);cout<<" Masukan Pilihan Anda => ";cin>>pil;
switch(pil){
case 1:
clrscr();
printf("nn Masukan Data => "); scanf("%d",&data);
enqueue(data);
break;
case 2:
clrscr();
dequeue();
break;
case 3:
clrscr();
cout<<endl;
tampil();
break;
case 4:
clrscr();
clear();
break;
case 5:
clrscr();
gotoxy(25,8);cout<<"**** TERIMA KASIH ****"<<endl;
break;
}
getch();
} while(pil!=5);
}

More Related Content

What's hot

Evolusi Antarmuka Komputer
Evolusi Antarmuka KomputerEvolusi Antarmuka Komputer
Evolusi Antarmuka Komputer
Andhi Pratama
 
Sistem basis data 4
Sistem basis data 4Sistem basis data 4
Sistem basis data 4
Fendi Hidayat
 
Array Dimensi banyak struktur data pertemuan ke 3
Array Dimensi banyak struktur data pertemuan ke 3Array Dimensi banyak struktur data pertemuan ke 3
Array Dimensi banyak struktur data pertemuan ke 3
said zulhelmi
 
Struktur data soal-latihan
Struktur data soal-latihanStruktur data soal-latihan
Struktur data soal-latihan
Bina Sarana Informatika
 
Soal uas struktur data
Soal uas struktur dataSoal uas struktur data
Soal uas struktur data
Bina Sarana Informatika
 
Analisis Algoritma - Pengantar Kompleksitas Algoritma
Analisis Algoritma - Pengantar Kompleksitas AlgoritmaAnalisis Algoritma - Pengantar Kompleksitas Algoritma
Analisis Algoritma - Pengantar Kompleksitas Algoritma
Adam Mukharil Bachtiar
 
Struktur Data Tree
Struktur Data TreeStruktur Data Tree
Struktur Data Tree
Siti Khotijah
 
Pertemuan 9 ok
Pertemuan 9 okPertemuan 9 ok
Pertemuan 9 ok
eli priyatna laidan
 
Sistem informasi penjualan minimarket berintegrasi barcode reader menggunakan
Sistem informasi penjualan minimarket berintegrasi barcode reader menggunakanSistem informasi penjualan minimarket berintegrasi barcode reader menggunakan
Sistem informasi penjualan minimarket berintegrasi barcode reader menggunakan
Olbers Letfaar
 
Analisis Algoritma - Langkah Desain Algoritma
Analisis Algoritma - Langkah Desain AlgoritmaAnalisis Algoritma - Langkah Desain Algoritma
Analisis Algoritma - Langkah Desain Algoritma
Adam Mukharil Bachtiar
 
Kisi kisi soal uas semester 2 BSI
Kisi  kisi soal uas semester 2 BSIKisi  kisi soal uas semester 2 BSI
Kisi kisi soal uas semester 2 BSI
Bina Sarana Informatika
 
Materi 3 Finite State Automata
Materi 3   Finite State AutomataMateri 3   Finite State Automata
Materi 3 Finite State Automata
ahmad haidaroh
 
MAKALAH STACK (TUMPUKAN )
MAKALAH STACK (TUMPUKAN )MAKALAH STACK (TUMPUKAN )
MAKALAH STACK (TUMPUKAN )
istiqlal
 
Intelijensia buatan - 03 Agen Pencarian (Searching Agent)
Intelijensia buatan - 03 Agen Pencarian (Searching Agent)Intelijensia buatan - 03 Agen Pencarian (Searching Agent)
Intelijensia buatan - 03 Agen Pencarian (Searching Agent)
KuliahKita
 
Model data relasional (3)
Model data relasional (3)Model data relasional (3)
Model data relasional (3)
Fariszal Nova
 
Algoritma Greedy (contoh soal)
Algoritma Greedy (contoh soal)Algoritma Greedy (contoh soal)
Algoritma Greedy (contoh soal)
Ajeng Savitri
 
Materi 3 operasi piksel dan histogram
Materi 3 operasi piksel dan histogramMateri 3 operasi piksel dan histogram
Materi 3 operasi piksel dan histogram
dedidarwis
 
Makalah manajemen proyek sistem informasi
Makalah manajemen proyek sistem informasiMakalah manajemen proyek sistem informasi
Makalah manajemen proyek sistem informasiAr Schwarzenegger
 
6. aspek ergonomi dalam imk
6. aspek ergonomi dalam imk6. aspek ergonomi dalam imk
6. aspek ergonomi dalam imk
Nafiz Curtuby
 
Cocomo
CocomoCocomo

What's hot (20)

Evolusi Antarmuka Komputer
Evolusi Antarmuka KomputerEvolusi Antarmuka Komputer
Evolusi Antarmuka Komputer
 
Sistem basis data 4
Sistem basis data 4Sistem basis data 4
Sistem basis data 4
 
Array Dimensi banyak struktur data pertemuan ke 3
Array Dimensi banyak struktur data pertemuan ke 3Array Dimensi banyak struktur data pertemuan ke 3
Array Dimensi banyak struktur data pertemuan ke 3
 
Struktur data soal-latihan
Struktur data soal-latihanStruktur data soal-latihan
Struktur data soal-latihan
 
Soal uas struktur data
Soal uas struktur dataSoal uas struktur data
Soal uas struktur data
 
Analisis Algoritma - Pengantar Kompleksitas Algoritma
Analisis Algoritma - Pengantar Kompleksitas AlgoritmaAnalisis Algoritma - Pengantar Kompleksitas Algoritma
Analisis Algoritma - Pengantar Kompleksitas Algoritma
 
Struktur Data Tree
Struktur Data TreeStruktur Data Tree
Struktur Data Tree
 
Pertemuan 9 ok
Pertemuan 9 okPertemuan 9 ok
Pertemuan 9 ok
 
Sistem informasi penjualan minimarket berintegrasi barcode reader menggunakan
Sistem informasi penjualan minimarket berintegrasi barcode reader menggunakanSistem informasi penjualan minimarket berintegrasi barcode reader menggunakan
Sistem informasi penjualan minimarket berintegrasi barcode reader menggunakan
 
Analisis Algoritma - Langkah Desain Algoritma
Analisis Algoritma - Langkah Desain AlgoritmaAnalisis Algoritma - Langkah Desain Algoritma
Analisis Algoritma - Langkah Desain Algoritma
 
Kisi kisi soal uas semester 2 BSI
Kisi  kisi soal uas semester 2 BSIKisi  kisi soal uas semester 2 BSI
Kisi kisi soal uas semester 2 BSI
 
Materi 3 Finite State Automata
Materi 3   Finite State AutomataMateri 3   Finite State Automata
Materi 3 Finite State Automata
 
MAKALAH STACK (TUMPUKAN )
MAKALAH STACK (TUMPUKAN )MAKALAH STACK (TUMPUKAN )
MAKALAH STACK (TUMPUKAN )
 
Intelijensia buatan - 03 Agen Pencarian (Searching Agent)
Intelijensia buatan - 03 Agen Pencarian (Searching Agent)Intelijensia buatan - 03 Agen Pencarian (Searching Agent)
Intelijensia buatan - 03 Agen Pencarian (Searching Agent)
 
Model data relasional (3)
Model data relasional (3)Model data relasional (3)
Model data relasional (3)
 
Algoritma Greedy (contoh soal)
Algoritma Greedy (contoh soal)Algoritma Greedy (contoh soal)
Algoritma Greedy (contoh soal)
 
Materi 3 operasi piksel dan histogram
Materi 3 operasi piksel dan histogramMateri 3 operasi piksel dan histogram
Materi 3 operasi piksel dan histogram
 
Makalah manajemen proyek sistem informasi
Makalah manajemen proyek sistem informasiMakalah manajemen proyek sistem informasi
Makalah manajemen proyek sistem informasi
 
6. aspek ergonomi dalam imk
6. aspek ergonomi dalam imk6. aspek ergonomi dalam imk
6. aspek ergonomi dalam imk
 
Cocomo
CocomoCocomo
Cocomo
 

Similar to contoh Program queue

Sorting programs
Sorting programsSorting programs
Sorting programs
Varun Garg
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
Rahul Chugh
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
Aditya Sharma
 
i am using C++ codingsource coding Program that sorts an arra.pdf
i am using C++ codingsource coding Program that sorts an arra.pdfi am using C++ codingsource coding Program that sorts an arra.pdf
i am using C++ codingsource coding Program that sorts an arra.pdf
ANJALIENTERPRISES1
 
C program
C programC program
C program
Komal Singh
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
Lakshmi Sarvani Videla
 
Pnno
PnnoPnno
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
Bilal Mirza
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
SANTOSH RATH
 
Program to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical orderProgram to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical order
Samsil Arefin
 
Data structures
Data structuresData structures
Data structures
gayatrigayu1
 
ADA FILE
ADA FILEADA FILE
ADA FILE
Gaurav Singh
 
Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdf
apexelectronices01
 
Cpds lab
Cpds labCpds lab
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
anujmkt
 
Ds
DsDs
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
Kandarp Tiwari
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
Eleanor McHugh
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 

Similar to contoh Program queue (20)

Sorting programs
Sorting programsSorting programs
Sorting programs
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
i am using C++ codingsource coding Program that sorts an arra.pdf
i am using C++ codingsource coding Program that sorts an arra.pdfi am using C++ codingsource coding Program that sorts an arra.pdf
i am using C++ codingsource coding Program that sorts an arra.pdf
 
C program
C programC program
C program
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
Pnno
PnnoPnno
Pnno
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
Program to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical orderProgram to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical order
 
Data structures
Data structuresData structures
Data structures
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdf
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
 
Ds
DsDs
Ds
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 

More from Bina Sarana Informatika

ANALISA DAN PERANCANGAN SISTEM INFORMASI
ANALISA DAN PERANCANGAN SISTEM INFORMASI ANALISA DAN PERANCANGAN SISTEM INFORMASI
ANALISA DAN PERANCANGAN SISTEM INFORMASI
Bina Sarana Informatika
 
948 p02
948 p02 948 p02
948 p01
948 p01 948 p01
948 p03
948 p03 948 p03
948 p06
948 p06948 p06
948 p04
948 p04948 p04
948 p03
948 p03948 p03
948 ltm metode penelitian - 3 sks
948 ltm metode penelitian - 3 sks948 ltm metode penelitian - 3 sks
948 ltm metode penelitian - 3 sks
Bina Sarana Informatika
 
Kuiz dasar manajemen bisnis pert 9 14
Kuiz dasar manajemen bisnis pert 9 14Kuiz dasar manajemen bisnis pert 9 14
Kuiz dasar manajemen bisnis pert 9 14
Bina Sarana Informatika
 
Silabus bahasa inggris ii
Silabus bahasa inggris iiSilabus bahasa inggris ii
Silabus bahasa inggris ii
Bina Sarana Informatika
 
Silabus bahasa inggris ii ok
Silabus bahasa inggris ii okSilabus bahasa inggris ii ok
Silabus bahasa inggris ii ok
Bina Sarana Informatika
 
Meeting 14 ok
Meeting 14 okMeeting 14 ok
Meeting 12 ok
Meeting 12 okMeeting 12 ok
Meeting 10 ok
Meeting 10 okMeeting 10 ok

More from Bina Sarana Informatika (20)

ANALISA DAN PERANCANGAN SISTEM INFORMASI
ANALISA DAN PERANCANGAN SISTEM INFORMASI ANALISA DAN PERANCANGAN SISTEM INFORMASI
ANALISA DAN PERANCANGAN SISTEM INFORMASI
 
948 p06
948 p06948 p06
948 p06
 
948 p05
948 p05 948 p05
948 p05
 
948 p04
948 p04948 p04
948 p04
 
948 p02
948 p02 948 p02
948 p02
 
948 p01
948 p01 948 p01
948 p01
 
948 p03
948 p03 948 p03
948 p03
 
948 p06
948 p06948 p06
948 p06
 
948 p05
948 p05948 p05
948 p05
 
948 p04
948 p04948 p04
948 p04
 
948 p03
948 p03948 p03
948 p03
 
948 p02
948 p02948 p02
948 p02
 
948 p01
948 p01948 p01
948 p01
 
948 ltm metode penelitian - 3 sks
948 ltm metode penelitian - 3 sks948 ltm metode penelitian - 3 sks
948 ltm metode penelitian - 3 sks
 
Kuiz dasar manajemen bisnis pert 9 14
Kuiz dasar manajemen bisnis pert 9 14Kuiz dasar manajemen bisnis pert 9 14
Kuiz dasar manajemen bisnis pert 9 14
 
Silabus bahasa inggris ii
Silabus bahasa inggris iiSilabus bahasa inggris ii
Silabus bahasa inggris ii
 
Silabus bahasa inggris ii ok
Silabus bahasa inggris ii okSilabus bahasa inggris ii ok
Silabus bahasa inggris ii ok
 
Meeting 14 ok
Meeting 14 okMeeting 14 ok
Meeting 14 ok
 
Meeting 12 ok
Meeting 12 okMeeting 12 ok
Meeting 12 ok
 
Meeting 10 ok
Meeting 10 okMeeting 10 ok
Meeting 10 ok
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 

contoh Program queue

  • 1. #include <stdio.h> #include <conio.h> #include <iostream.h> #define MAX 6 typedef struct { int data[MAX]; int head; int tail; }queue; queue antrian; void create() { antrian.head=antrian.tail=-1; } int isempty() { if(antrian.tail==-1) return 1; else return 0; }
  • 2. int isfull() { if(antrian.tail==MAX-1) return 1; else return 0; } void enqueue(int data) { if(isempty()==1) { antrian.head=antrian.tail=0; antrian.data[antrian.tail]=data; printf("%d, Sudah Masuk!",antrian.data[antrian.tail]); void tampil(); { int i; if (isempty()==0) { for(i=antrian.head;i<=antrian.tail;i++) { printf(" %d ",antrian.data[i]); } }
  • 3. else printf("n**** QUEUE IS EMPTY ****n"); } } else if(isfull()==0) { antrian.tail++; antrian.data[antrian.tail]=data; printf("%d , Sudah Masuk!",antrian.data[antrian.tail]); } else{ if(isfull()==1) { cout<<"nn**** QUEUE IS FULL , data TIDAK dapat masuk ****"; } } gotoxy(25,8);cout<<"PRESS any key for back to MENU"; } int dequeue() { if (isempty()==1){ cout<<"n**** ERROR :: QUEUE IS EMPTY ****";
  • 4. }else if(isempty()==0){ int i; int e=antrian.data[antrian.head]; for(i=antrian.head;i<=antrian.tail-1;i++) { antrian.data[i]=antrian.data[i+1]; } antrian.tail--; cout<<"nnData Yang Keluar => "<<e; } gotoxy(25,8);cout<<"PRESS any key for back to MENU"; } void clear() { antrian.head=antrian.tail=-1; printf("nn**** DATA CLEAR ****"); gotoxy(25,8);cout<<"PRESS any key for back to MENU"; } void tampil() { int i; if(isempty()==0)
  • 5. { cout<<"Data Yang ada Dalam QUEUE : "<<endl<<endl; for(i=antrian.head;i<=antrian.tail;i++) { printf("| %d |",antrian.data[i]); } } else { printf("n**** QUEUE IS EMPTY ****n"); } gotoxy(25,8);cout<<"PRESS any key for back to MENU"; } void main() { int pil; int data; create(); do { clrscr(); gotoxy(25,2);cout<<"========MENU PILIHAN========"<<endl<<endl; gotoxy(25,4);cout<<"============================"<<endl; gotoxy(30,6);cout<<" 1. ENQUEUE "<<endl;
  • 6. gotoxy(30,7);cout<<" 2. DEQUEUE "<<endl; gotoxy(30,8);cout<<" 3. TAMPILAN "<<endl; gotoxy(30,9);cout<<" 4. CLEAR "<<endl; gotoxy(30,10);cout<<" 5. KELUAR "<<endl; gotoxy(25,12);cout<<"============================"<<endl; gotoxy(25,14);cout<<" Masukan Pilihan Anda => ";cin>>pil; switch(pil){ case 1: clrscr(); printf("nn Masukan Data => "); scanf("%d",&data); enqueue(data); break; case 2: clrscr(); dequeue(); break; case 3: clrscr(); cout<<endl; tampil(); break;
  • 7. case 4: clrscr(); clear(); break; case 5: clrscr(); gotoxy(25,8);cout<<"**** TERIMA KASIH ****"<<endl; break; } getch(); } while(pil!=5); }