kasir

May 27, 2008 at 4:11 am (C++)

#include<iostream.h>
#include<conio.h>
#include<string.h>

void main()
{
float barang[3][3];
int i,j=0;
char *nama[1];

//ADMIN
for(i=0;i<3;i++)
{
cout<<“masukkan kode barang”;
cin>>barang[i][0];
cout<<“masukkan harga barang”;
cin>>barang[i][1];
cout<<“masukkan diskon barang”;
cin>>barang[i][2];
cout<<endl;
}
for(i=0;i<3;i++) {
for(j=0;j<3;j++)
cout<<barang[i][j]<<” “;
cout<<endl;
}

//KASIR
cout<<endl<<endl;
int kode,jumlah;
float harga,diskon,bayar,total;
cout<<“masukkan kode barang : “;
cin>>kode;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
if(kode==barang[i][j])
{
cout<<“\tharga barang : “<<barang[i][1]<<endl;
harga=barang[i][1];
cout<<“\tdiskon barang : “<<barang[i][2]<<” jika pembelian diatas 100″<<endl;
diskon=barang[i][2];
}
}
cout<<endl;
cout<<“masukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;
if(jumlah>=100)
total=bayar-(diskon*bayar);
else
{
total=bayar;
diskon=0;
}
cout<<“\tbayar : “<<bayar<<endl;
cout<<“\tdiskon : “<<diskon*bayar<<endl;
cout<<“\ttotal bayar : “<<total<<endl;
}

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: