Skip to content

Instantly share code, notes, and snippets.

@adhikasp
Created February 14, 2015 14:58
Show Gist options
  • Save adhikasp/6d0aceca4fbb682831a9 to your computer and use it in GitHub Desktop.
Save adhikasp/6d0aceca4fbb682831a9 to your computer and use it in GitHub Desktop.
Halo Fia
//Alifianty Delila Imani Sumantri
//16414021
//14022015
//deskripsiprogram : program tokobuku
//Program KasirTokoBuku
//Menghitung jumlah pembelian dari pelanggan
#include <iostream>
#include <string>
using namespace std;
int main ()
{
//variabel
int pensil;
int pulpen;
int buku;
int totalitem;
int diskon;
int hargatotal;
double hargaakhir;
//Algoritma
cin >> pensil;
cin >> pulpen;
cin >> buku;
totalitem = pensil+pulpen+buku;
cout<<totalitem<<endl;
if (totalitem <= 10) cout<<"Tidak ada diskon"<<endl;
else if (10<totalitem>=20){cout<<"diskon=10%"<<endl;}
else if (totalitem>20){cout<<"diskon=15%"<<endl;}
hargatotal = (pensil*1000)+(pulpen*2500)+(buku*5000);
cout<<hargatotal<<endl;
if (totalitem<=10)
hargaakhir=hargatotal;
else if (10<totalitem>=20)
hargaakhir=(1-0.1)*hargatotal;
else if (totalitem>=20)
hargaakhir=(1-0.15)*hargatotal;
cout << hargaakhir;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment