#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
char kdb[2],jwb;
char nm[25],nmb[20],nmm[8],bns[20];
int kdm;
double hrgm,jmlb,jmlm,hrgb,totb,totm,tot,pot,tobay,ubay,ukem;
clrscr();
lagi:
cout<<"\t Saung Bakso Reot";
cout<<"-----------------------------------------";
cout<<"Nama Pemesan :";gets(nm);
cout<<"\n Kode Porsi [OS/US/BS] :";cin>>kdb;
if (kdb=="OS"||kdb=="os")
{
strcpy(nmb,"Bakso Otak Sapi");
hrgb=20000;
}
else if(kdb=="US"||kdb=="us")
{
strcpy(nmb,"Bakso Urat Sapi");
hrgb=25000;
}
else if (kdb=="BS"||kdb=="bs")
{
strcpy(nmb,"Bakso Aneka Buah");
hrgb=30000;
}
else
{
cout<<"\nKode Salah";
getche();
goto lagi;
}
cout<<"\n Jumlah Porsi Bakso :";cin>>jmlb;
totb=hrgb*jmlb;
cout<<"\n Kode Minuman [1/2/3] :";cin>>kdm;
switch(kdm)
{
case 1:
strcpy(nmm,"Tea Botol");
hrgm=7000;
break;
case 2:
strcpy(nmm,"Fanta");
hrgm=7500;
break;
case 3:
strcpy(nmm,"Coca-cola");
hrgm=8000;
break;
default:
cout<<"\nKode Salah";
getche();
goto lagi;
break;
}
cout<<"\n Jumlah Beli Minuman :";cin>>jmlm;
totm=hrgm+jmlm;
tot=totb+totm;
if (tot>=200000)
{
strcpy(bns,"3 mangkok bakso");
pot=0.1*tot;
}
else if (tot>=100000)
{
strcpy(bns,"3 lemon tea");
pot=0.05*tot;
}
else
{
strcpy(bns,"Maaf Tidak Dapat Bonus");
pot=0;
}
tobay=tot-pot;
clrscr();
cout<<"\t\t ****Struk**** "<<endl;
cout<<"********************************************"<<endl;
cout<<endl;
cout<<"\n Nama Pemesan :";cout<<nm;
cout<<"Nama bakso :"<<nmb<<endl;
cout<<"Harga bakso :Rp."<<hrgb<<endl;
cout<<"Total Harga Bakso :Rp."<<totb<<endl;
cout<<"Nama Minuman :"<<nmm<<endl;
cout<<"Harga Minuman :"<<hrgm;cout<<" jam"<<endl;
cout<<"Harga Minuman :Rp."<<hrgm<<endl;;
cout<<"Total Harga Minuman :Rp."<<totm<<endl;
cout<<"********************************************"<<endl;
cout<<endl;
cout<<"Total :Rp."<<tot<<endl;;
cout<<"Diskon :Rp."<<pot<<endl;
cout<<"Bonus :"<<bns<<endl;
cout<<"Total Bayar :Rp."<<tobay<<endl;;
cout<<"\nUang Bayar :Rp.";cin>>ubay;
ukem=ubay-tobay;
cout<<"Uang Kembali :Rp."<<ukem<<endl;
cout<<"____________________________________________"<<endl;
cout<<"Mau input data lagi [Y/T]:";jwb=getche();
if (jwb=='Y'||jwb=='y')
goto lagi;
getch();
}
kopas dari kak fatur ya ??
BalasHapussalah :"(