Queue - program #2
Heii.. Ketemu lagi J hahahhaa
Inilah program Queue
nyaa J
Outputnya seperti ini:
Codingnya ini:
#include <stdio.h>
#include <conio.h>
void main()
{
int cek=0, data[20], x, hapus,v,z;
char pil;
do {
clrscr ();
printf (" |
____________________
|\n");
printf (" |
*-~{_____KELOMPOK 2_____}~-*
|\n");
printf (" | |\n");
printf (" | >> Ainurrohmah (19110462) |\n");
printf (" | >> Indri Noviyanti (13110539) |\n");
printf (" | >> Teuku Arif Nurhadi
(16110864) |\n");
printf (" | >> Roro Rizky Ananda (16110243) |\n");
printf (" | Kelas
: 2KA01 |\n");
printf (" | Materi : Queue |\n");
printf ("
|__________________________________|\n\n");
printf ("\n MENU\n");
printf (" ----\n");
printf (" 1. Tambah
Antrian\n");
printf (" 2. Hapus Antrian\n");
printf (" 3. Lihat Antrian\n");
printf (" 4. Keluar\n");
printf (" Silahkan masukkan pilihan
anda... ");
pil=getche();
if (pil!='1' && pil !='2' && pil !='3' &&
pil!='4' )
printf ("\n\nAnda salah mengetikkan
inputan...\n");
else
{
if (pil=='1') //PUSH
{
if (cek==20)
printf
("\nAntrian Penuh\n\n");
else
{
printf ("\nMasukkan nilai -->
");scanf("%i",&x);
data[cek]=x;
cek++;
}
}
else
{
if (pil=='2') //POP
{
if
(cek==0)
printf("\nAntrian kosong\n\n");
else
{
hapus=data[0];
for (v=0;v<cek;v++)
data[v]=data[v+1];
data[cek-1]=NULL;
cek--;
printf ("\nData dengan nilai=%i
terhapus.",hapus);
}
getch ();
}
else
{
if (pil=='3') //CEK DATA
{
if (cek==0)
printf ("\nAntrian Kosong.\n\n");
else
{
printf ("\n");
for (z=0;z<cek;z++)
{
printf (" | ");
printf ("%i",data[z]);
printf(" | ");
}
}
getch ();
}
}
}
}
} while (pil!='4');
}
done! Alhamdulillah tugas selesai J
Happy ngoding *\(^_^)/*
1:57:00 PM
|
Label:
kampus,
materi belajar
|
Langganan:
Posting Komentar (Atom)
indrinovii. Diberdayakan oleh Blogger.
- Gunadarma University
- Baak Online
- StaffSite Universitas Gunadarma
- StudentSite Gunadarma
- Virtual Class Universitas Gunadarma
- LePKom Gunadarma
- iLab Gunadarma
- Laboratorium Fisika Gunadarma
- Lab Manajemen Lanjut Gunadarma
- UG Conference
- Perpustakaan Universitas Gunadarma
- FIKTI Universitas Gunadarma
- UG Knowledge Based portal
news Studentsite
kamu pengunjung ke-
follow blog aku yaa :)
Facebook ku :)
AUXILIARY 2010
Full TAW ISE
www.flickr.com
This is a Flickr badge showing public photos and videos from iin.indrinoviyanti. Make your own badge here.
0 komentar:
Posting Komentar