Friday, April 15, 2011

Program dasar pada Kasir

Berikut script yang mendasari pada program kasir...


#include<iostream.h>
#include<conio.h>
void main()
{

char kode[4];
float jml_beli[4];
int subtotal, total=0;

cout<<"Input Barang(A/B)"<<endl;

for(int i=0;i<4;i++)
{
cout<<"Kode Barang  : ";
cin>>kode[i];
cout<<"Jumlah Beli  : ";
cin>>jml_beli[i];
cout<<endl;

if(kode[i]=='A')
subtotal= 100 * jml_beli[i];
if(kode[i]=='B')
subtotal= 50 * jml_beli[i];
total= total + subtotal;
}
cout<<endl<<"Total Bayar : "<<total<<endl;
getch();
}

Selamat mencoba!!!!

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home