Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- #include<strinh.h>
- int main(){
- char*kode;
- char*nama;
- char*bon;
- char ulang;
- long jumlah,harga,total,todis,tobel,bayar,dis;
- clrcr();
- do
- {
- cout<<"kode barang : "; cin>>kode;
- if(strcmp(kode,"P17")==0){
- nama="Lays";
- harga=9800;
- } else if(strcmp(kode,"Q48")==0){
- nama="Oreo";
- harga=8300;
- } else if(strcmp(kode,"R59")==0){
- nama="Chitato";
- harga=10400;
- } else if(strcmp(kode,"S60")==0){
- nama="Timtam";
- harga=7300;
- }
- cout<<"nama barang :"<<nama<<endl;
- cout<<"harga barang :"<<harga<<endl;
- cout<<"jumlah beli : ";cin>>jumlah;
- total=harga*jumlah;
- cout<<"total : "<<total<<endl;
- if (jumlah>=5){
- todis=total*0.1;
- tobel=total-todis;
- cout<<endl;
- } else if (jumlah<=4){
- todis=0;
- tobel=total-todis;
- cout<<endl;
- } else if (jumlah>=3){
- bon="coklat";
- cout<<endl;
- } else if (jumlah<=2){
- bon="tidak ada";
- cout<<endl;
- }
- cout<<"Diskon :"<<todis<<endl;
- cout<<"total belanja :"<<tobel<<endl;
- if (jumlah>=3){
- bon="coklat";
- } else if (jumlah<=2){
- bon="tidak ada";
- }
- cout<<"bonus :"<<bon<<endl;
- cout<<"masih ada ? Y/T:"; cin>>ulang;
- }
- while(ulang=='Y');
- cout<<"Terimakasih";
- return 0;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement