Deque
Deque
NIM : 221011401773
KELAS : 03TPLP010
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#define n 15
void INSERTL();
void INSERTR();
void DELETEL();
void DELETER();
void CETAKLAYAR();
void Inisialisasi();
void RESET();
int PIL,F,R,L;
char Q[n];
int main ()
//ATHALLAH
Inisialisasi();
do
cout<<"======================"<<endl;
cout<<"======================"<<endl;
cout<<"======================"<<endl;
cout<<"1. INSERT KIRI "<<endl;
cout<<"6. QUIT"<<endl;
cout<<"PILIHAN : ";cin>>PILIHAN;
PIL=atoi(PILIHAN);
switch (PIL)
case 1:
INSERTL();
break;
case 2:
INSERTR();
break;
case 3:
DELETEL();
break;
case 4:
DELETER();
break;
case 5:
CETAKLAYAR();
break;
default:
cout<<"TERIMA KASIH"<<endl;
break;
getch();
system("cls");
while (PIL<6);
void INSERTL()
if(L<n+1)
L=L-1;
cin>>HURUF;
Q[L]=HURUF;
else
cout<<"Antrian Penuh"<<endl;
void INSERTR()
if(R<n-1)
cin>>HURUF;
R=R+1;
Q[R]=HURUF;
else
cout<<"Antrian Penuh"<<endl;
void CETAKLAYAR()
if (L<R+1)
{
cout<<"Q["<<i<<"]="<<Q[i]<<endl;
else
cout<<"Antrian Kosong"<<endl;
void DELETEL()
if(L<=R+1)
HURUF=Q[L];
L=L+1;
Q[L++]='1';
if(L==n)
RESET();
else
cout<<"Antrian Kosong"<<endl;
void DELETER()
if (L<=R+1)
HURUF=Q[R];
R=R-1;
Q[R++]='1';
if(R==n)
RESET();
}
else
cout<<"Antrian Kosong"<<endl;
void Inisialisasi()
L=0;
R=-1;
void RESET()
L=0;
R=-1;