www.dunia-dacil.co.cc

Minggu, 07 November 2010

membuat program cafe dengan borland c++

TEKNIK INFORMATIKA UNPAM

Contoh program sederhana pada sebuah cafe

#include

#include

#include

main()

{

char kd;

char mn,menu[20];

long int hrg,byr,ppn,ttl,u_byr,u_kembali,byk;

clrscr();

cout<<"***cafe star dacil***"<

cout<<"============================================="<

cout<<"A. menu minuman "<

cout<<" 1.kopi mocca "<

cout<<" 2.kopi tubruk "<

cout<<" 3.bir pletok "<

cout<<"B. menu makanan tradisional "<

cout<<" 1. kerak telor "<

cout<<" 2. gado-gado "<

cout<<" 3. tahu gejrot "<

cout<<"C. menu makanan modern "<

cout<<" 1. burger blenger "<

cout<<" 2. pizza "<

cout<<" 3. spageti "<

cout<<"\nMasukan Jenis menu [A/B/C] :";cin>>kd;

cout<<"\nMasukan pilihan menu [1/2/3] :";cin>>mn;

cout<<"\nBanyak Beli :";cin>>byk;

if(kd=='A'||kd=='a')

{strcpy(menu,"minuman");

if(mn=='1')hrg=15000;

else if(mn=='2')hrg=26000;

else hrg=45000;}

else if(kd=='B'||kd=='b')

{strcpy(menu,"makanan tradisional");

if(mn=='1')hrg=17000;

else if(mn=='2')hrg=12000;

else hrg=5000;}

else

{strcpy(menu,"makanan modern");

if (mn=='1')hrg=250000;

else if(mn=='2')hrg=38000;

else hrg=70000;}

cout<<"Menu :"<

cout<<"Harga :"<

byr=hrg*byk;

cout<<"Pembayaran :"<

ppn=0.1*byr;

ttl=byr+ppn;

cout<<"PPN :"<

cout<<"Total Bayar :"<

cout<<"Uang Bayar :";cin>>u_byr;

u_kembali=u_byr-ttl;

cout<<"Uang Kembali :"<

cout<<"Terima Kasih Telah berkunjung"<

getch();

}