#include <iostream>
using namespace std;
int main(){
int kode_barang, a, harga, jml, bayar, kembali;
char nama[50];
cout<<"Daftar Barang"<<endl;
cout<<"1. Gorengan "<<endl;
cout<<"2. Resoles "<<endl;
cout<<"3. Martabak "<<endl;
cout<<"4. Brownis "<<endl;
cout<<"5. Lumpia "<<endl;
cout<<"pilih kode makanan(1/2/3/4/5) =";
cin>>kode_barang;
cout<<"jumlah makanan =";cin>>a;
switch(kode_barang){
case 1:
strcpy(nama,"gorengan");
harga=500;
break;
case 2:
strcpy(nama,"resoles");
harga=1000;
break;
case 3:
strcpy(nama,"martabak");
harga=1500;
break;
case 4:
strcpy(nama,"brownis");
harga=2000;
break;
case 5:
strcpy(nama,"lumpia");
harga=1000;
break;
}
jml=harga*a;
cout<<"Harga satuan =Rp "<<harga<<endl;
cout<<"Total =Rp "<<jml<<endl;
cout<<"Bayar =Rp ";
cin>>bayar;
if(bayar<jml)
{
cout<<"uang anda kurang "<<endl;
}
else
{
kembali=bayar-jml;
cout<<"kembalian =Rp "<<kembali<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
hasil nya :
0 comments:
Post a Comment