Kali ini saya akan share codingan sebuah
aplikasi yang menggunakan Array. Tidak cuma Array, ada seleksi kondisi If nya
juga. Bukan hasil murni bikinan sendiri sih hihihi. Yang bikin teman saya
namanya Dwi Lasto. Tapi dia juga tidak 100% bikin sendiri codingannya. Dia
dapet dari internet juga, kemudian dia gabungkan coding-codingan tersebut, dan
hasilnya seperti di bawah ini:
codingan dari hasil di atas:
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
brand(){int i;
gotoxy(2,4);cout<<"\xcc"; for(i=3;i<=76;i++) cprintf("\xCD"); gotoxy(3,76);cout<<"\xB9";
gotoxy(4,3);cout<<">>>>>>>>>> PIZZA LA-PIZZA DELIVERY <<<<<<<<<";}
design()
{
textcolor(BLUE);
gotoxy(2,2);
cprintf("\xC9");
int i;
for(i=1;i<=74;i++)
cprintf("\xCD");
gotoxy(77,2);
cprintf("\xBB");
gotoxy(2,3);cprintf("\xBA");gotoxy(2,4);cprintf("\xBA");gotoxy(2,5);cprintf("\xBA");gotoxy(2,6);cprintf("\xBA");
gotoxy(2,7);cprintf("\xBA");gotoxy(2,8);cprintf("\xBA");gotoxy(2,9);cprintf("\xBA");gotoxy(2,10);cprintf("\xBA");
gotoxy(2,11);cprintf("\xBA");gotoxy(2,12);cprintf("\xBA");gotoxy(2,13);cprintf("\xBA");gotoxy(2,14);cprintf("\xBA");
gotoxy(2,15);cprintf("\xBA");gotoxy(2,16);cprintf("\xBA");gotoxy(2,17);cprintf("\xBA");gotoxy(2,18);cprintf("\xBA");
gotoxy(2,19);cprintf("\xBA");gotoxy(2,20);cprintf("\xBA");gotoxy(2,21);cprintf("\xBA");gotoxy(2,22);cprintf("\xCC");
gotoxy(2,23);cprintf("\xBA");gotoxy(2,24);cprintf("\xC8");
gotoxy(3,24);
for(i=1;i<=74;i++)
cprintf("\xCD");
gotoxy(77,18);cprintf("\xBA");gotoxy(77,19);cprintf("\xBA");gotoxy(77,20);cprintf("\xBA");gotoxy(77,21);cprintf("\xBA");
gotoxy(77,23);cprintf("\xBA");gotoxy(77,24);cprintf("\xBC");
gotoxy(3,22);
for(i=1;i<=74;i++)
cprintf("\xCD");
gotoxy(77,22);cprintf("\xB9");gotoxy(77,3);cprintf("\xBA");gotoxy(77,4);cprintf("\xBA");gotoxy(77,5);cprintf("\xBA");
gotoxy(77,6);cprintf("\xBA");gotoxy(77,7);cprintf("\xBA");gotoxy(77,8);cprintf("\xBA");gotoxy(77,9);cprintf("\xBA");
gotoxy(77,10);cprintf("\xBA");gotoxy(77,11);cprintf("\xBA");gotoxy(77,12);cprintf("\xBA");gotoxy(77,13);cprintf("\xBA");
gotoxy(77,14);cprintf("\xBA");gotoxy(77,15);cprintf("\xBA");gotoxy(77,16);cprintf("\xBA");gotoxy(77,17);cprintf("\xBA");
gotoxy(16,23); cout<<"\t\t>>>>>> KELOMPOK 1 <<<<<<";
//tim();
}
main()
{
char nama[10],*jenis[10],kopiz[10][10],lagi;
int i,a,b,harga[10],qty[10],no,bayar;
float sub[10],kembali;
long totbay;
clrscr(); loggin:
//============loggin===============////
char kasir[15]; int id;
design();
brand();
gotoxy(49,5);cout<<"kasir id : "; cin>>id;
if(id==5742)
{strcpy(kasir,"Dwi Lasto P");}
else if(id==1767)
{strcpy(kasir,"Nurul Hlmi");}
else if(id==5499)
{strcpy(kasir,"Enggar");}
else if(id==4958)
{strcpy(kasir,"Nofitasari");}
else if(id==3569)
{strcpy(kasir,"Abdul Muchlis");}
else if(id==5803)
{strcpy(kasir,"Ahmad M U");}
else {clrscr();
design();
brand();
gotoxy(10,6);cout<<"id yang anda masukan salah atau tidak terdaftar ";getch();clrscr();
goto loggin;}
//============================(1)PESAN SEKARANG===============================//
atas:
design();
brand();
gotoxy(4,6);cout<<"No.Pesan : ";cin>>no;
gotoxy(4,7);cout<<"Nama Pemesanan : ";cin>>nama;
gotoxy(4,8);cout<<"Banyak Jenis Pzza : ";cin>>b;
for(a=1;a<=b;++a) //===========rumus looping array =======
{
gotoxy(4,10);cout<<"Pizza Ke "<<a<<endl;
gotoxy(4,11);cout<<"Kode Pizza [BR/CC/MC] : ";cin>>kopiz[a];
gotoxy(4,12);cout<<"Jumlah Pesan : ";cin>>qty[a];clrscr();design(); brand();
//================seleksi kondisi===================////////
if(strcmp(kopiz[a],"BR")==0||strcmp(kopiz[a],"br")==0)
{jenis[a]="Beef Royale";
harga[a]=55000;}
else
if(strcmp(kopiz[a],"CC")==0||strcmp(kopiz[a],"cc")==0)
{jenis[a]="Chicken Cheese";
harga[a]=60000;}
else
if(strcmp(kopiz[a],"MC")==0||strcmp(kopiz[a],"mc")==0)
{jenis[a]="Mushroom Crazy";
harga[a]=45000;}
else
{cout<<"Salah!!,Input Kode Lagi!!"<<endl;
goto atas;}
}
clrscr();
design(); brand();
cout<<"\n\t\t\t Bukti Pemesanan Pizza\n";
cout<<"\tNo.Pesan : "<<no<<"\t\t\tKasir : "<<kasir<<endl;
cout<<"\tNama Pemesan : "<<nama<<endl;
cout<<" ***************************************************************************";
cout<<"\n No. Jenis Harga Jumlah Subtotal "<<endl;
cout<<" =========================================================================="<<endl;
cout<<endl;
design();brand();
totbay=0;
for(a=1;a<=b;++a)//rumus total bayar array///////
{
gotoxy(4,a+11); cout<<a;
gotoxy(10,a+11); cout<<jenis[a];
gotoxy(30,a+11); cout<<harga[a];
gotoxy(47,a+11); cout<<qty[a];
sub[a]=harga[a]*qty[a];
gotoxy(60,a+11); cout<<sub[a];
cout<<endl;
totbay=totbay+sub[a];
}
gotoxy(3,a+11); cout<<"=========================================================================="<<endl;
gotoxy(39,a+13);cout<<"Total Bayar :Rp. "<<totbay<<endl;
gotoxy(39,a+14);cout<<"Uang Bayar :Rp. ";cin>>bayar;
kembali=bayar-totbay;
gotoxy(39,a+15);cout<<"Uang Kembali :Rp. "<<kembali;// design();brand(); getch();
design();brand(); getch();
clrscr();
design();brand();
gotoxy(14,11);cout<<"Input data lagi [Y]/[T]? :";cin>>lagi;
if(lagi=='Y'||lagi=='y')
{clrscr();goto atas;}
else
goto loggin;
getch();
exit:
}
0 komentar:
Posting Komentar