Contoh Program Pointer

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<string.h>

void foods ()
{
clrscr();

for (int x=0;x<=15;x++)
{
textcolor (0+x);
gotoxy(10,2);cprintf(” ÛÛ      ÛÛ  ÛÛ ÛÛ    ÛÛ   ÛÛ   ÛÛÛÛÛ  ÛÛÛÛ  ÛÛ     ÛÛ  ÛÛÛÛ    “);
gotoxy(10,3);cprintf(“ÛÛ        ÛÛ    ÛÛ    ÛÛ   ÛÛ   ÛÛÛÛÛ ÛÛ  ÛÛ ÛÛÛ    ÛÛ ÛÛÛÛÛÛ   “);
gotoxy(10,4);cprintf(“ÛÛ        ÛÛ ÛÛ ÛÛ    ÛÛ   ÛÛ     ÛÛ  ÛÛ  ÛÛ ÛÛÛÛ   ÛÛ ÛÛ       “);
gotoxy(10,5);cprintf(“ÛÛ   ÛÛ   ÛÛ ÛÛ ÛÛ    ÛÛ   ÛÛ     ÛÛ  ÛÛÛÛÛ  ÛÛ ÛÛ  ÛÛ ÛÛ ÛÛÛ   “);
gotoxy(10,6);cprintf(” ÛÛ ÛÛÛÛ ÛÛ  ÛÛ ÛÛ    ÛÛ   ÛÛ     ÛÛ  ÛÛ     ÛÛ  ÛÛ ÛÛ ÛÛ   ÛÛ  “);
gotoxy(10,7);cprintf(”  ÛÛÛÛ ÛÛÛÛ  ÛÛ ÛÛ    ÛÛ   ÛÛ  ÛÛ ÛÛ  ÛÛ  ÛÛ ÛÛ   ÛÛÛÛ ÛÛÛÛÛÛ   “);
gotoxy(10,8);cprintf(”   ÛÛ   ÛÛ   ÛÛ ÛÛÛÛÛ  ÛÛÛÛÛ    ÛÛÛ    ÛÛÛÛ  ÛÛ     ÛÛ  ÛÛÛÛ    “);
delay(200);

}

}

void main()
{

textcolor(LIGHTGREEN);

clrscr();

int a,x,jumlah[10],data;
char kode[10][10];
char nama[10][30];
long harga[10],total[10],tamp;
char np1[15];
char np2[15];
long int byr=0;
foods ();
for(x=1;x<=100;x++)
{
textcolor(LIGHTRED);gotoxy(27,11);cprintf(“KELOMPOK 6”);delay(25);
textcolor(LIGHTRED);gotoxy(38,11);cprintf(“MEMPERSEMBAHKAN”);delay(25);
gotoxy(38,13);cout<<“[“<<x<<“%]”;delay(20);
}
for(x=1;x<=50;x++)
{
textcolor(a);gotoxy(16+x,15);cprintf(“Û”);delay(25);
}

gotoxy(34,18);cout<<“SUNDANESE FOODS\n”;

delay(1500);
textcolor(LIGHTBLUE);
textbackground(WHITE);
clrscr();
do{
gotoxy(30,5);cout<<“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» “;
gotoxy(30,6);cout<<“º      MENU        º “;
gotoxy(30,7);cout<<“ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ “;
gotoxy(30,8);cout<<“º 1.PESAN          º “;
gotoxy(30,9);cout<<“ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ “;
gotoxy(30,10);cout<<“º 2.LIHAT PESANAN  º “;
gotoxy(30,11);cout<<“ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ “;
gotoxy(30,12);cout<<“º 3.KELUAR         º “;
gotoxy(30,13);cout<<“ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ “;

gotoxy(24,18);cout<<“MASUKAN PERINTAH ANDA [1/2/3] : “;cin>>a;
clrscr();
switch(a){
case 1:{
isi:
clrscr();
gotoxy(41,18);cout<<“MASUKAN JUMLAH ORANG MAX.10 : “;cin>>data;
if (data > 10){
gotoxy(41,20);cout<<“EROR, Maksimal 10!”;
gotoxy(41,21);cout<<“Silahkan isi kembali.”;
getch();
goto isi;
}
cout<<endl;
for(x=0;x<data;x++)
{
atas:
clrscr();
gotoxy(1,2);cout<<“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍ»”;
gotoxy(1,3);cout<<“º      DAFTAR MAKANAN      º  HARGA   º”;
gotoxy(1,4);cout<<“ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍ͹”;
gotoxy(1,5);cout<<“º 1. Paket 1               º   10000  º”;
gotoxy(1,6);cout<<“º    -Nasi                 º          º”;
gotoxy(1,7);cout<<“º    -Gurame Asam Manis    º          º”;
gotoxy(1,8);cout<<“º 2. Paket 2               º   9000   º”;
gotoxy(1,9);cout<<“º    -Nasi                 º          º”;
gotoxy(1,10);cout<<“º    -Telur Dadar          º          º”;
gotoxy(1,11);cout<<“º    -Tumis Kiciwis        º          º”;
gotoxy(1,12);cout<<“º 3. Nasi Ayam Bakar       º   10000  º”;
gotoxy(1,13);cout<<“º 4. Nasi Ayam Goreng      º   10000  º”;
gotoxy(1,14);cout<<“º 5. Nasi Ayam Serundeng   º   10000  º”;
gotoxy(1,15);cout<<“º 6. Nasi Ayam Sambel Ijo  º   10000  º”;
gotoxy(1,16);cout<<“º 7. Nasi Gepuk            º   10000  º”;
gotoxy(1,17);cout<<“º 8. Nasi Goreng Biasa     º    7000  º”;
gotoxy(1,18);cout<<“º 9. Nasi Goreng Spesial   º   10000  º”;
gotoxy(1,19);cout<<“º 10. Mie Goreng + Telur   º    5000  º”;
gotoxy(1,20);cout<<“º 11. Mie Rebus + Telur    º    5000  º”;
gotoxy(1,21);cout<<“º 12. Lotek + Nasi         º    7500  º”;
gotoxy(1,22);cout<<“º 13. Karedok + Nasi       º    7500  º”;
gotoxy(1,23);cout<<“º 14. Gado-Gado Komplit    º    8000  º”;
gotoxy(1,24);cout<<“º 15. Nasi + Pencok Kacang º    6000  º”;
gotoxy(1,25);cout<<“ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍͼ”;

gotoxy(40,2);cout<<“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍ»”;
gotoxy(40,3);cout<<“º      DAFTAR MINUMAN       º   HARGA  º”;
gotoxy(40,4);cout<<“ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍ͹”;
gotoxy(40,5);cout<<“º A. Es Jeruk               º   3500   º”;
gotoxy(40,6);cout<<“º B. Lemon Tea              º   2500   º”;
gotoxy(40,7);cout<<“º C. Teh Botol              º   2500   º”;
gotoxy(40,8);cout<<“º D. Mocacino Dingin/Panas  º   2500   º”;
gotoxy(40,9);cout<<“º E. Capucino Dingin/Panas  º   3000   º”;
gotoxy(40,10);cout<<“º F. Susu Putih/Coklat      º   2500   º”;
gotoxy(40,11);cout<<“º G. Kopi Black             º   2000   º”;
gotoxy(40,12);cout<<“º H. Kopi Susu              º   2500   º”;
gotoxy(40,13);cout<<“º I. Aqua Botol             º   2500   º”;
gotoxy(40,14);cout<<“º J. Teh Tawar Panas/Dingin º   1000   º”;
gotoxy(40,15);cout<<“º K. Teh Manis Panas/Dingin º   2000   º”;
gotoxy(40,16);cout<<“ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍͼ”;

gotoxy(41,19);cout<<“MASUKAN KODE MAKANAN “<<” KE “<<x+1<<” : “;
cin>>kode[x];

if(strcmp(kode[x],”1″) == 0){
strcpy(nama[x],”Paket 1″);
harga[x]=10000;
}
else if(strcmp(kode[x],”2″) == 0){
strcpy(nama[x],”Paket 2″);
harga[x]=10000;
}
else if(strcmp(kode[x],”3″) == 0){
strcpy(nama[x],”Nasi Ayam Bakar”);
harga[x]=10000;
}
else if(strcmp(kode[x],”4″) == 0){
strcpy(nama[x],”Nasi Ayam Goreng”);
harga[x]=10000;
}
else if(strcmp(kode[x],”5″) == 0){
strcpy(nama[x],”Nasi Ayam Serundeng”);
harga[x]=10000;
}
else if(strcmp(kode[x],”6″) == 0){
strcpy(nama[x],”Nasi Ayam Sambel Ijo”);
harga[x]=10000;
}
else if(strcmp(kode[x],”7″) == 0){
strcpy(nama[x],”Nasi Gepuk”);
harga[x]=10000;
}
else if(strcmp(kode[x],”8″) == 0){
strcpy(nama[x],”Nasi Goreng Biasa”);
harga[x]=7000;
}
else if(strcmp(kode[x],”9″) == 0){
strcpy(nama[x],”Nasi Goreng Spesial”);
harga[x]=10000;
}
else if(strcmp(kode[x],”10″) == 0){
strcpy(nama[x],”Mie Goreng + Telur”);
harga[x]=35000;
}
else if(strcmp(kode[x],”11″) == 0){
strcpy(nama[x],”Mie Rebus + Telur”);
harga[x]=5000;
}
else if(strcmp(kode[x],”12″) == 0){
strcpy(nama[x],”Lotek + Nasi”);
harga[x]=7500;
}
else if(strcmp(kode[x],”13″) == 0){
strcpy(nama[x],”Karedok + Nasi”);
harga[x]=7500;
}
else if(strcmp(kode[x],”14″) == 0){
strcpy(nama[x],”Gado-Gado Komplit”);
harga[x]=8000;
}
else if(strcmp(kode[x],”15″) == 0){
strcpy(nama[x],”Nasi + Pencok Kacang”);
harga[x]=6000;
}
else if((strcmp(kode[x],”A”) == 0) || (strcmp(kode[x],”a”) == 0)){
strcpy(nama[x],”Es Jeruk”);
harga[x]=3500;
}
else if((strcmp(kode[x],”B”) == 0) || (strcmp(kode[x],”b”) == 0)){
strcpy(nama[x],”Lemon Tea”);
harga[x]=2500;
}
else if((strcmp(kode[x],”C”) == 0) || (strcmp(kode[x],”c”) == 0)){
strcpy(nama[x],”Teh Botol”);
harga[x]=2500;
}
else if((strcmp(kode[x],”D”) == 0) || (strcmp(kode[x],”d”) == 0)){
strcpy(nama[x],”Mocacino Dingin/Panas”);
harga[x]=2500;
}
else if((strcmp(kode[x],”E”) == 0) || (strcmp(kode[x],”e”) == 0)){
strcpy(nama[x],”Capucino Dingin/Panas”);
harga[x]=3000;
}
else if((strcmp(kode[x],”F”) == 0) || (strcmp(kode[x],”f”) == 0)){
strcpy(nama[x],”Susu Putih/Coklat”);
harga[x]=2500;
}
else if((strcmp(kode[x],”G”) == 0) || (strcmp(kode[x],”g”) == 0)){
strcpy(nama[x],”Kopi Black”);
harga[x]=2000;
}
else if((strcmp(kode[x],”H”) == 0) || (strcmp(kode[x],”h”) == 0)){
strcpy(nama[x],”Kopi Susu”);
harga[x]=2500;
}
else if((strcmp(kode[x],”I”) == 0) || (strcmp(kode[x],”i”) == 0)){
strcpy(nama[x],”Aqua Botol”);
harga[x]=2500;
}
else if((strcmp(kode[x],”J”) == 0) || (strcmp(kode[x],”j”) == 0)){
strcpy(nama[x],”Teh Tawar Panas/Dingin”);
harga[x]=1000;
}
else if((strcmp(kode[x],”K”) == 0) || (strcmp(kode[x],”k”) == 0)){
strcpy(nama[x],”Teh Manis Panas/Dingin”);
harga[x]=2000;
}

else{
gotoxy(41,21);cout<<“Tidak ada dalam pilihan!”;
gotoxy(41,22);cout<<“Silahkan isi kembali.”;
getch();
goto atas;
}

gotoxy(41,21);cout<<“\t” << nama[x];
cout<<endl;
gotoxy(41,23);cout<<“\t MAU BERAPA ??  “;cin>>jumlah[x];
clrscr();

total[x]=harga[x]*jumlah[x];
}
clrscr();
break;
}
case 2:{
cout<<“__________________________________________________________________\n”;
cout<<“NO\tNAMA PESANAN\tJUMLAH\t\tHARGA\t\tTOTAL\t\n”;
cout<<“__________________________________________________________________\n”<<endl;

for(x=0;x<data;x++){
byr=byr+total[x];
cout<<x+1<<“\t”<<nama[x]<<“\t\t”<<jumlah[x]<<“\t\t”<<harga[x]<<“\t\t”<<total[x]<<“\n”;}

cout<<“\n\n\nTOTAL YANG ANDA HARUS BAYAR SEBESAR : Rp “<<byr<<endl;
cout<<“\n\nTEKAN ENTER UNTUK KEMBALI KE MENU UTAMA”;
getch();
clrscr();
}
break;
case 3:

break;
}
}
while(a!=3)
;
error:

}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s