Program pembelian barang
#include <iostream>
#include <windows.h>
using namespace std;
main()
{
char kode;
long harga, total;
int jumlah;
system("Color 0A");
cout<<"PROGRAM PEMBELIAN BARANG "<<endl;
cout<<"BY ANGGRI LUKMAN "<<endl;
cout<<"A. SENDAL"<<endl;
cout<<"B. SEPATU"<<endl;
cout<<"C. KAOS KAKI"<<endl;
cout<<"\nkode barang?(A,B,C) ";
cin>>kode;
switch (kode){
case 'a':
case 'A':
cout<<"\nNama Barang = sendal"<<'\n';
harga=45500;
break;
case 'b':
case 'B':
cout<<"\nNama Barang = sepatu"<<'\n';
harga=95000;
break;
case 'c':
case 'C':
cout<<"\nNama Barang = kaos kaki"<<'\n';
harga=5000;
break;
default :
cout<<"\nTidak ada pilihan "<<'\n';
break;
}
cout<<"\nHarga Barang = "<<harga<<'\n';
cout<<"\nJumlah Barang yang dibeli? ";cin>>jumlah;
total=harga*jumlah;
cout<<"\nTotal belanja = "<<total<<'\n';
switch (total)
{
case 5000 ... 10000 :
cout<<"\nBonus = Tidak ada ";
break;
case 10001 ... 25000 :
cout<<"\nBonus = buku ";
break;
case 25001 ... 50000 :
cout<<"\nBonus = penggaris ";
break;
default :
cout<<"\nBonus = Tas";
break;
}
}
Tidak ada komentar:
Posting Komentar