Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- using namespace std;
- main()
- {
- char rasa[3],nama[30],pembeli[30],input;
- int harga,jumlah,total,jumtotal,jumbayar,kembalian,potongan;
- system("cls");
- awal:
- cout<<"============================================"<<endl;
- cout<<" CM ICE CREAM "<<endl;
- cout<<"============================================"<<endl;
- cout<<"Input Nama Pembeli : ";cin>>pembeli;
- cout<<"Pilihan Rasa Ice Cream Yang Tersedia"<<endl;
- cout<<">1. Chocolate Strawberry"<<endl;
- cout<<">2. Chocolate Vanilla"<<endl;
- cout<<">3. Chocolate Capucinno"<<endl;
- cout<<"Ice Cream Yang Anda Pilih : ";cin>>rasa;
- cout<<"Jumlah Beli : ";cin>>jumlah;
- if(strcmp(rasa,">1.")==0){
- strcpy(nama,"Chocolate Strawberry");
- harga=15000;
- }
- else if(strcmp(rasa,">2.")==0){
- strcpy(nama,"Chocolate Vanilla");
- harga=20000;
- }
- else{
- strcpy(nama,"Chocolate Capucinno");
- harga=25000;
- }
- system("cls");
- cout<<"============================================"<<endl;
- cout<<"Nama Pembeli : "<<pembeli<<endl;
- cout<<"Nama Ice Cream : "<<nama<<endl;
- cout<<"Harga : "<<harga<<endl;
- cout<<"Jumlah : "<<jumlah<<endl;
- total=harga*jumlah;
- cout<<"Total : "<<total<<endl;
- if(rasa==">1."||total>40000){
- potongan=0.05*total;
- }
- else if(rasa==">2."&&total>50000){
- potongan=0.1*total;
- }
- else{
- potongan=0;
- }
- cout<<"Potongan : "<<potongan<<endl;
- cout<<"============================================"<<endl;
- jumtotal=total-potongan;
- cout<<"Total Keseluruhan Harga : "<<jumtotal<<endl;
- cout<<"Uang Bayar : ";cin>>jumbayar;
- kembalian=jumbayar-jumtotal;
- cout<<"Uang Kembali : "<<kembalian<<endl;
- cout<<"============================================"<<endl;
- cout<<"Mau Beli Lagi[Y/N]? : ";cin>>input;
- if(input=='Y'||input=='y')
- goto awal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement