RSS

Toko Buah Fruity Fresh

12 Jun

#include
#include
#include
hargabuah(char kode[2],char**nm,float*harga,float*jumbel,float*diskon)
{
if(strcmpi(kode,”A”)==0){*nm=”APEL FUJI”;*harga=30000;
if(*jumbel>5){*diskon=0.25*(*harga)*(*jumbel);}else{*diskon=0;}}
else
if(strcmpi(kode,”J”)==0){*nm=”JERUK”;*harga=25000;
if(*jumbel>5){*diskon=0.5*(*harga)*(*jumbel);}else{*diskon=0;}}
else
if(strcmpi(kode,”L”)==0){*nm=”Lengkeng Bangkok”;*harga=35000;
if(*jumbel>5){*diskon=0.1*(*harga)*(*jumbel);}else{*diskon=0;}}
}
main()
{
struct
{
char kode[2],*nm;
float harga,jumbel,diskon,jumbay;
}buah[10];
int i,j;
float bayar,kembali,tobay;
clrscr();
cout<<"TOKO BUAH FRUITY FRESS"<<endl;
cout<<"=-=-=-=-=-=-=-=-=-=-=-=-"<<endl;
cout<>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<>buah[i].kode;
cout<>buah[i].jumbel;
hargabuah(buah[i].kode,&buah[i].nm,&buah[i].harga,&buah[i].jumbel,&buah[i].diskon);
cout<<endl;
}
clrscr();
cout<<"DATA TRANSAKSI PENJUALAN"<<endl;
cout<<"FRUITY FRESS"<<endl;
cout<<"=-=-=-=–=-==-=-=-=-=-=-=-="<<endl;
for(i=1;i<=j;i++)
{
cout<<"Nama Buah:"<<buah[i].nm<<endl;
cout<<"Jumlah Beli:"<<buah[i].jumbel<<endl;
cout<<"Harga:"<<buah[i].harga<<endl;
buah[i].jumbay=(buah[i].jumbel*buah[i].harga)-buah[i].diskon;
cout<<"Jumlah Bayar:"<<buah[i].jumbay<<endl;
tobay=tobay+buah[i].jumbay;
cout<<endl;
}
cout<<"Total Bayar:"<<tobay<<endl;
cout<>bayar;
kembali=bayar-tobay;
cout<<"Kembali:"<<kembali<<endl;
getch();
}

 
Leave a comment

Posted by on June 12, 2011 in C ++, Computer

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: