#include<stdio.h>
#include<conio>
#include<iostream.h>
main()
{
long harga=0, potongan=0, total=0;
int jumlahpembelian;
char kode, namabuku[30];
char pilihan, yes;
cout<<"SELAMAT DATANG DITOKO BUKU KAMI"<<endl;
pilihan:
cout<<"==================="<<endl;
cout<<"DAFTAR KODE BUKU"<<endl;
cout<<"A. GARIS WAKTU"<<endl;
cout<<"B. 11:11"<<endl;
cout<<"C. ARAH LANGKAH"<<endl;
cout<<"===================="<<endl;
cout<<"SILAHKAN PILIH KODE BUKU [A/B/C] = "; cin>>kode;
cout<<"JUMLAH BUKU YANG DIBELI = "; cin>>jumlahpembelian;
if(kode == 'A' || kode == 'a') {
strcpy(namabuku, "GARIS WAKTU");
harga = 25000; }
else if(kode == 'B' || kode == 'b') {
strcpy(namabuku, "11:11");
harga = 22000; }
else if(kode == 'C' || kode == 'c') {
strcpy(namabuku, "ARAH LANGKAH");
harga = 26000; }
else {
clrscr();
cout<<"KODE TIDAK DITEMUKAN"<<endl;
goto pilihan; }
if(jumlahpembelian > 0){
if(harga * jumlahpembelian >= 100000){
potongan = 0.1 * harga * jumlahpembelian;
}
total = (harga * jumlahpembelian) - potongan; }
else {
clrscr();
cout<<"PEMBELIAN BATAL"<<endl;
goto pilihan; }
if (total > 0) {
clrscr();
detailpembelian:
cout<<"=========================="<<endl;
cout<<" DETAIL PEMBELIAN BUKU "<<endl;
cout<<"=========================="<<endl;
cout<<"NAMA BUKU : "<<namabuku<<endl;
cout<<"HARGA BUKU : Rp. "<<harga<<",-"<<endl;
cout<<"JUMLAH BUKU : "<<jumlahpembelian<<" BUKU"<<endl;
cout<<"POTONGAN : Rp. "<<potongan<<",-"<<endl;
cout<<"==========================="<<endl;
cout<<"TOTAL BAYAR : Rp. "<<total<<",-"<<endl; }
else {
goto pilihan; }
getch();
}