Berikut adalah sintaksnya dan bisa juga didownload disini:
#include <conio.h>
#include <iostream.h>
#include <stdio.h>
main()
{
char nama[30],kd,bonus[20];
int jml;
long int hrg,ppn,total,pot;
cout<<"create by abe_here";
clrscr();
cout<<" TOKO BUKU BAGUS"<<endl;
cout<<"Jl. Kebagusan No.69"<<endl;
cout<<"==================="<<endl;
cout<<"Kode [A/B/C]: ";cin>>kd;
switch(kd)
{
case 'A':
case 'a':
{strcpy(nama,"5 CM");
hrg=50000;}
break;
case 'B':
case 'b':
{strcpy(nama,"Kambing Jantan");
hrg=45000;}
break;
case 'C':
case 'c':
{strcpy(nama,"Laskar Pelangi");
hrg=55000;}
break;
default:
cout<<"Anda Salah Memasukkan Kode";
break;
}
cout<<"Nama Buku\t\t: "<<nama<<endl;
cout<<"Harga Buku\t\t: "<<hrg<<endl;
cout<<"Jumlah Buku\t\t: ";cin>>jml;
if(jml>=3)
{pot=0.1*hrg*jml;
strcpy(bonus,"Notepad");}
else
{pot=0;
strcpy(bonus,"Anda Tidak Dapat Bonus");}
cout<<"Anda Dapat Potongan\t: "<<pot<<endl;
cout<<"Bonus\t\t\t: "<<bonus<<endl;
ppn=0.02*jml*hrg;
total=(hrg*jml)-ppn;
cout<<"Total Bayar\t\t: "<<total<<endl;
getche();
}
No comments:
Post a Comment