/*PROGRAM DISCOUNT DENGAN FUNGSI*/#include<conio.h>#include<iostream.h>#pragma argsused
double price;
double discount(double rp){double disc=rp*20/100;price=rp-disc;cout<<"Discount : Rp "<<disc<<endl;cout<<"Harga setelah discount : Rp "<<price<<endl;}double sisauang(double pay){double sisa=pay-price;cout<<"Sisa uang : Rp "<<sisa<<endl;}int main(){double rp,pay;cout<<"PROGRAM DISKON"<<endl;cout<<"=============="<<endl;cout<<endl;cout<<"***********************************************"<<endl;cout<<"*Diskon 20% untuk pembelian Rp100.000 keatas !*"<<endl;cout<<"***********************************************"<<endl;cout<<endl;cout<<"-----------------------------------------------"<<endl;cout<<"Masukkan harga barang : Rp "; cin>>rp;cout<<"Jumlah nominal yang dibayar : Rp "; cin>>pay;cout<<endl;cout<<"-----------------------------------------------"<<endl;cout<<endl;if(pay>=rp){if(rp>=100000){discount(rp);}else{cout<<"Discount : Rp 0"<<endl;price=rp;}sisauang(pay);}
else{cout<<"MAAF UANG ANDA TIDAK CUKUP !"<<endl;}cout<<endl;cout<<"***"<<endl;getch();}
0 comments:
Post a Comment