Multi Transaksi

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

#include<iostream.h>
#include<conio.h>
const int total_pembayaran= 3;
void main()
{
unsigned long tgl_pembelian,bulan,tahun;
char jawab;
float barang[3][3];
int i,j=0;
char *nama[1];

clrscr();

awal:
cout<<“\t\t\t SOPHIE SWALAYAN”<<endl;
cout<<“\t\t”<<endl;
cout<<“\t\t\tjalan Urip Sumoharjo 40″<<endl;
cout<<“\t\t”<<endl;
cout<<“\t\t\ttelepon (0354)446296″<<endl;
cout<<“\t\t”<<endl;
cout<<“______________________________________________________________________”<<endl;

cout<<“\t\t”<<endl;

cout<<“\t\tmasukkan tgl_pembelian : “;
cin>>tgl_pembelian;
cout<<“\t\tmasukkan bulan : “;
cin>>bulan;
cout<<“\t\tmasukkan tahun : “;
cin>>tahun;

cout<<endl;

cout<<“\t\t**********************************”<<endl;
cout<<“\t\t* tanggal transaksi : “<<tgl_pembelian<<“/”<<bulan<<“/”<<tahun<<” *”<<endl;
cout<<“\t\t**********************************”<<endl;

cout<<“\t\t”<<endl;

//ADMIN
for(i=0;i<3;i++)
{
cout<<“\t\t#########################”<<endl;
cout<<“\t\t# kode barang :”;
cin>>barang[i][0];
cout<<“\t\t# harga barang :”;
cin>>barang[i][1];
cout<<“\t\t# diskon barang:”;
cin>>barang[i][2];
cout<<“\t\t#########################”<<endl;
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_harga;
float total_pembayaran;
float totalA,totalB,totalC;

cout<<“\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@”<<endl;
cout<<“\t\t@ A.membeli 1 macam barang @”<<endl;
cout<<“\t\t@ B.membeli 2 macam barang @”<<endl;
cout<<“\t\t@ C.membeli 3 macam barang @”<<endl;
cout<<“\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@”<<endl;
cout<<“\t\tmasukkan pilihan anda : “;
cin>>jawab;

cout<<endl;

cout<<“\t\t”<<endl;

if((jawab==’A’)||(jawab==’a’))
{
cout<<“\t\tmasukkan 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<<“\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;

cout<<“\t\t”<<endl;

if(kode==1)
{
cout<<“\t\tnama=speaker”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
total_harga=bayar-(diskon*bayar);
else
{
total_harga=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
total_harga=bayar-(diskon*bayar);
else
{
total_harga=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
total_harga=bayar-(diskon*bayar);
else
{
total_harga=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal harga : “<<total_harga<<endl;
}
else if((jawab==’B’)||(jawab==’b’))
{
cout<<“\t\tmasukkan kode barang A : “;
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<<“\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;

cout<<“\t\t”<<endl;

if(kode==1)
{
cout<<“\t\tnama=speaker”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalA=bayar-(diskon*bayar);
{
totalA=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
totalA=bayar-(diskon*bayar);
else
{
totalA=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalA=bayar-(diskon*bayar);
else
{
totalA=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal bayar A : “<<totalA<<endl;

cout<<endl;

cout<<“masukkan kode barang B : “;
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<<“\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;

cout<<“\t\t”<<endl;

if(kode==1)
{
cout<<“\t\tnama=speaker”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalB=bayar-(diskon*bayar);
else
{
totalB=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
totalB=bayar-(diskon*bayar);
else
{
totalB=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalB=bayar-(diskon*bayar);
else
{
totalB=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal bayar B : “<<totalB<<endl;

cout<<endl;

total_pembayaran=totalA+totalB;
cout<<“\t\t___________________________________________”<<endl;
cout<<“\t\t total pembayaran = “<<total_pembayaran<<endl;
cout<<“\t\t___________________________________________”<<endl;

cout<<“\t\t”<<endl;

cout<<“____________________________________________________________________________________”<<endl;

cout<<“\t\t\tterima kasih telah mengunjungi swalayan kami”<<endl;

}
else if((jawab==’C’)||(jawab==’c’))
{
cout<<“\t\tmasukkan kode barang A : “;
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<<“\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;

cout<<“\t\t”<<endl;

if(kode==1)
{
cout<<“\t\tnama=speaker”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalA=bayar-(diskon*bayar);
{
totalA=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
totalA=bayar-(diskon*bayar);
else
{
totalA=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalA=bayar-(diskon*bayar);
else
{
totalA=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal bayar A : “<<totalA<<endl;

cout<<endl;

cout<<“masukkan kode barang B : “;
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<<“\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;

cout<<“\t\t”<<endl;

if(kode==1)
{
cout<<“\t\tnama=speaker”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalB=bayar-(diskon*bayar);
else
{
totalB=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
totalB=bayar-(diskon*bayar);
else
{
totalB=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalB=bayar-(diskon*bayar);
else
{
totalB=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal bayar B : “<<totalB<<endl;

cout<<endl;

cout<<“masukkan kode barang C : “;
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<<“\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga;

cout<<“\t\t”<<endl;

if(kode==1)
{
cout<<“\t\tnama=speaker”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalC=bayar-(diskon*bayar);
else
{
totalC=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
totalC=bayar-(diskon*bayar);
else
{
totalC=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
totalC=bayar-(diskon*bayar);
else
{
totalC=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal bayar C : “<<totalC<<endl;

cout<<endl;

total_pembayaran=totalA+totalB+totalC;
cout<<“\t\t___________________________________________”<<endl;
cout<<“\t\t total pembayaran = “<<total_pembayaran<<endl;
cout<<“\t\t___________________________________________”<<endl;

cout<<“\t\t”<<endl;

cout<<“__________________________________________________________________”<<endl;

cout<<“\t\t\tterima kasih telah mengunjungi swalayan kami”<<endl;

}
else
cout<<“\t\tkode yg anda masukkan salah”<<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: