Contoh switch case

ini dia contoh pemrograman switch case c++ hay gays yukkk cekidot kita liat #include #include #define novel 2000 #define komik 1000 #define majalah 1500 #define diskon 0.1 main(){ int buku,jml,total,disc; cout<<"==================================================="<>buku; switch(buku){ case 1 : cout<<"\nMasukkan banyak buku yang ingin di pinjam : ";cin>>jml; if(jml>=5){ disc=jml*novel*diskon; total=(jml*novel)-disc; } else{ total=jml*novel; } cout<<"\nTotal yang harus di bayar : Rp. "<>jml; if(jml>=5){ disc=jml*komik*diskon; total=(jml*komik)-disc; } else{ total=jml*komik; } cout<<"\nTotal yang harus di bayar : Rp. "<>jml; if(jml>=5){ disc=jml*majalah*diskon; total=(jml*majalah)-disc; } else{ total=jml*majalah; } cout<<"\nTotal yang harus di bayar : Rp. "<

0 komentar:

Posting Komentar