AlgoritmaTugas11.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; void garis() { puts("--------------------------------------------------"); } void ttd() { cout<<"Nama : Irsyad Purbha"<<endl; cout<<"Email : irsyadpurbha.fst@uia.ac.id"<<endl; } void judul() { garis(); cout<<"Toko Buku Almara"<<endl; cout<<"Jatiasih - Bekasi"<<endl; garis(); } int main() { judul(); cout<<"KETENTUAN"<<endl; garis(); cout<<"| Kode | Judul | Harga |"<<endl; garis(); cout<<"| 1 | Sukses Belajar C++ | 50.000 |"<<endl; cout<<"| 2 | Kunci Pribadi Yang Sukses | 35.000 |"<<endl; cout<<"| 3 | Mencari Mutiara Di Dasar Hati | 45.000 |"<<endl; garis(); cout<<"Subtotal = Harga x Jumlah Beli"<<endl; cout<<"PPN = 10% x Subtotal"<<endl; cout<<"Jika jumlah beli lebih dari 5 maka mendapat discount 10% "; cout<<"dan bonus kotak pensil."<<endl; garis(); char kode, nama[50], bonus[50]; int jml; float harga, subtotal, pot, ppn, total; printf("Masukan kode buku [1/2/3]: <input>"); cin>>kode; cout<<endl; printf("Jumlah pembelian buku : <input>"); cin>>jml; cout<<endl; switch (kode) { case '1': strcpy(nama,"Sukses Belajar C++"); harga = 50000; break; case '2': strcpy(nama,"Kunci Pribadi Yang Sukses"); harga = 35000; break; default: strcpy(nama,"Mencari Mutiara Di Dasar Hati"); harga = 45000; } subtotal = harga * jml; ppn = 0.1 * subtotal; if(jml > 5) { strcpy(bonus,"Kotak Pensil"); pot = 0.1 * subtotal; } else { strcpy(bonus,"Maaf Tidak Dapat Bonus"); pot = 0; } total = subtotal + ppn - pot; garis(); cout<<"Nama Buku : "<<nama<<endl; cout<<"Harga Buku : "<<harga<<endl; cout<<"Bonus : "<<bonus<<endl; printf("Subtotal : Rp. %0.2f\n",subtotal); printf("Potongan : Rp. %0.2f\n",pot); printf("PPN : Rp. %0.2f\n",ppn); printf("Total : Rp. %0.2f\n",total); garis(); puts("Terima Kasih"); garis(); ttd(); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines