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<<"=================================="<<endl;
- cout<<"==========Toko ICE CREAM=========="<<endl;
- cout<<"=================================="<<endl<<endl;
- cout<<" input nama pembeli:";cin>>nama;cout<<endl;
- cout<<" pilihan es krim yang tersedia:"<<endl;
- cout<<"1. Chocolate Strowberry"<<endl;
- cout<<"2. Chocolate Vanila"<<endl;
- cout<<"3. Chocolate Capucinno"<<endl;
- cout<<"es krim yang dipilih: ";cin>>pilih;
- switch(pilih){
- case 1:
- harga=15000;
- es="Chocolate Strowberry";
- break;
- case 2:
- harga=20000;
- es="Chocolate Vanila";
- break;
- case 3:
- harga=25000;
- es="Chocolate Capucinno";
- 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.05;
- }else if(total < 40000){
- diskon = total * 0;
- }
- hasil = total - diskon;
- kembalian = uang - hasil;
- system("cls");
- cout<<"=============================="<<endl;
- cout<<" Struk Pembayaran"<<endl;
- cout<<"=============================="<<endl;
- cout<<"Nama pembeli: "<<nama<<endl;
- cout<<"Nama es krim: "<<es<<endl;
- cout<<"Harga: "<<harga<<endl;
- cout<<"Total: "<<total<<endl;
- cout<<"potongan: "<<diskon<<endl;
- cout<<"=============================="<<endl;
- cout<<"Total keseluruhan: "<<hasil<<endl;
- cout<<"Uang bayar: "<<uang<<endl;
- cout<<"Uang kembali: "<<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