Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<iomanip>
- #include<stdlib.h>
- #include<string>
- using namespace std;
- int main(){
- char ulang;
- string es, nama;
- int total, harga, pilih, jumlah, hasil, diskon, uang, kembalian;
- mulai:
- cout<<" CM ICECREAM"<<endl;
- cout<<"======================="<<endl<<endl;
- cout<<"input nama pembeli:";cin>>nama;cout<<endl;
- cout<<"pilihan eskrim yang tersedia:"<<endl;
- cout<<"1.chocolate strawberry"<<endl;
- cout<<"2.chocolate vanila"<<endl;
- cout<<"3.chocolate capucino"<<endl;
- cout<<"es krim yang dipilih:";cin>>pilih;
- switch(pilih){
- case 1:
- harga=15000;
- es="chocolate strawberry";
- break;
- case 2:
- harga=20000;
- es="chocolate vanila";
- break;
- case 3:
- harga=25000;
- es="chocolate capucino";
- break;
- }
- cout<<"jumlah beli:";cin>>jumlah;
- cout<<"uang pembeli:";cin>>uang;
- total=jumlah*harga;
- if(total>50000){
- diskon=total*0.10;
- } else if(total>40000 && total<50000){
- diskon=total*0.5;
- }
- hasil = total - diskon;
- kembalian= uang - hasil;
- system("cls");
- cout<<" Struk pembayaran"<<endl;
- cout<<"========================"<<endl;
- cout<<"Nama pembeli:"<<nama<<endl;
- cout<<"Nama eskrim:"<<es<<endl;
- cout<<"Harga:"<<harga<<endl;
- cout<<"Jumlah:"<<jumlah<<endl;
- cout<<"Total:"<<total<<endl;
- cout<<"Potongan:"<<diskon<<endl;
- cout<<"======================="<<endl;
- cout<<"Total keseluruhan:"<<hasil<<endl;
- cout<<"Uang bayar:"<<uang<<endl;
- cout<<"Uang kembalian:"<<kembalian<<endl;
- cout<<"mau input lagi (Y/N)?";cin>>ulang;
- if(ulang=='Y' || ulang=='y'){
- system("cls");
- goto mulai;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement