#include<iostream.h> #include<conio.h> int main() { clrscr(); char kode; char* nama_barang; char* merk_barang; char* tipe_barang; long int jml_harga, jml, harga_barang,total,ppn; cout<<"------------ Daftar Harga HP Smarfren -------------\n"; cout<<" 1: Hp Smartfren Andromax G2 LE, harga Rp 1.070.000 \n"; cout<<" 2: Hp Smartfren Andromax G2 QWERTY Rp 979.000\n"; cout<<" 3: Hp Smartfren Andromax V3S Rp 1.999.000\n"; cout<<" 4: Hp Smartfren Andromax I3 Rp 1.499.000\n"; cout<<"---------------------------------------------------\n"; cout<<"\n"; cout<<"Masukan kode barang : "; cin>>kode; cout<<"masukan jumlah pembelian : "; cin>>jml; cout<<"\n"; cout<<"\n"; if (kode =='1' ) { nama_barang ="Hp Smartfren Andromax"; merk_barang ="Smartfren"; tipe_barang ="G2 LE"; harga_barang =1070000; jml_harga=harga_barang*jml; ppn=jml_harga*0.05; total=jml_harga+ppn; } if (kode =='2' ) { nama_barang ="Hp Smartfren Andromax"; merk_barang ="Smartfren"; tipe_barang ="G2 QWERTY"; harga_barang =979000; jml_harga=harga_barang*jml; ppn=jml_harga*0.05; total=jml_harga+ppn; } if (kode =='3' ) { nama_barang ="Hp Smartfren Andromax"; merk_barang ="Smartfren"; tipe_barang ="V3S" ; harga_barang =1999000; jml_harga=harga_barang*jml; ppn=jml_harga*0.05; total=jml_harga+ppn; } if (kode =='4' ) { nama_barang ="Hp Smartfren Andromax"; merk_barang ="Smartfren"; tipe_barang ="I3" ; harga_barang =1499000; jml_harga=harga_barang*jml; ppn=jml_harga*0.05 ; total=jml_harga+ppn ; } cout<<"Nama barang : " <<nama_barang<<endl; cout<<"Merk barang : " <<merk_barang<<endl; cout<<"Tipe barang : " <<tipe_barang<<endl; cout<<"Harga barang : " <<harga_barang<<endl; cout<<"Jumlah Harga : " <<jml_harga<<endl; cout<<"PPN : " <<ppn<<endl; cout<<"Total Harga : " <<total<<endl; getch(); } |
kurang lebih seperti ini sahabat blogger tampilannya
terima kasih telah berkunjung di blog saya.
0 Response to " Contoh Program Menggunakan IF-ELSE di C++ "
Post a Comment