Edit Admin

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

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

void main()
{
unsigned long tgl_pembelian,harga_baru,diskon_baru,bulan,tahun;
char pilihan,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;
}

atas:
//KASIR
cout<<endl<<endl;
int kode,jumlah;
float harga,diskon,bayar,total;

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<<“\t\tharga barang : “<<barang[i][1]<<endl;
harga=barang[i][1];
cout<<“\t\tdiskon barang : “<<barang[i][2]<<” jika pembelian diatas 100″<<endl;
diskon=barang[i][2];
}
}
cout<<endl;
cout<<“\t\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=bayar-(diskon*bayar);
else
{
total=bayar;
diskon=0;
}
}
else if(kode==2)
{
cout<<“\t\tnama=keyboard”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>50)
total=bayar-(diskon*bayar);
else
{
total=bayar;
diskon=0;
}
}
else if(kode==3)
{
cout<<“\t\tnama=mouse”<<endl;
cout<<“\t\t”<<endl;
if(jumlah>100)
total=bayar-(diskon*bayar);
else
{
total=bayar;
diskon=0;
}
}
cout<<“\t\tbayar : “<<bayar<<endl;
cout<<“\t\tdiskon : “<<diskon*bayar<<endl;
cout<<“\t\ttotal bayar : “<<total<<endl;

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

cout<<“\t\tanda ingin mengedit ADMIN?(pilihan Y||T) : “;
cin>>pilihan;

cout<<endl;

if((pilihan==’Y’)||(pilihan==’y’))
{
cout<<“\t\t\t@@@@@@@@@@@@@@@”<<endl;
cout<<“\t\t\t@ EDIT ADMIN @”<<endl;
cout<<“\t\t\t@@@@@@@@@@@@@@@”<<endl;
cout<<endl;
cout<<“\t\masukkan kode yg ingin di edit : “;
cin>>kode;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
if(kode==barang[i][j])
{
cout<<“\tMasukkan harga baru : “;
cin>>barang[i][1];
cout<<“\t\t#######################”<<endl;
cout<<“\t\t# harga baru : “<<barang[i][1]<<” #”<<endl;
harga_baru=barang[i][1];
cout<<“\t\t#######################”<<endl;
cout<<“\tMasukkan diskon baru : “;
cin>>barang[i][2];
cout<<“\t\t#######################”<<endl;
cout<<“\t\t# diskon baru : “<<barang[i][2]<<” #”<<endl;
diskon_baru=barang[i][2];
cout<<“\t\t#######################”<<endl;
}
}

//KASIR
cout<<endl<<endl;
int kode,jumlah;
float harga,diskon,bayar,total;

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<<“\t\tharga barang baru : “<<barang[i][1]<<endl;
harga_baru=barang[i][1];
cout<<“\t\tdiskon barang baru : “<<barang[i][2]<<” jika pembelian diatas 100″<<endl;
diskon_baru=barang[i][2];
}
}
cout<<endl;
cout<<“\t\tmasukkan jumlah barang : “;
cin>>jumlah;
bayar=jumlah*harga_baru;
cout<<“\t\t”<<endl;

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

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

cout<<“anda ingin melanjutkan?(jawab Y/T) : “;
cin>>jawab;
if((jawab==’Y’)||(jawab==’y’))
goto atas;
else
{
cout<<“_________________________________________________________________”<<endl;

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

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

}
}
else if((pilihan==’T’)||(pilihan==’t’))
{
cout<<“______________________________________________________________________________”<<endl;

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

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

cout<<“\t\tanda ingin melanjutkan?(jawab Y||T) : “;
cin>>jawab;
if((jawab==’Y’)||(jawab==’y’))
{
clrscr();
goto awal;
}
else
getch;
}
else
{
cout<<“\t\tkode yg anda masukkan tidak ada diprogram kami”<<endl;
getch;
}
}

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: