Program C++ Menampilkann Daftar dan Harga Buku
- Dengan program sebagai berikut :
#include <iostream>
using namespace std;
int main(){
int harga, total,kode_buku;
cout<<"\t DAFTAR HARGA BUKU\n";
cout<<"\t*************************\n";
cout<<"\t TOKO BUKU ANGGREK BIRU\n";
cout<<"\t*************************\n";
cout<<"\n| Kode Buku | Judul Buku | Harga/buah |";
cout<<"\n| 01 | Awan Biru | 35.000,00 |";
cout<<"\n| 02 | Gubuk | 20.000,00 |";
cout<<"\n| 03 | Kupu-Kupu | 25.000,00 |";
cout<<"\n\nMasukkan kode buku = ";
cin>>kode_buku;
if(kode_buku==01){
cout<<"Judul = Awan Biru \nHarga = Rp35.000,00\n";
harga=35.000,00;
}
else if(kode_buku==02){
cout<<"\nJudul = Gubuk \nHarga = Rp20.000,00\n";
harga=20.000,00;
}
else if(kode_buku==03){
cout<<"\nJudul = Kupu-Kupu \nHarga = Rp25.000,00\n";
harga=25.000,00;
}
else if(kode_buku>03){
cout<<"\nKode yang anda masukkan salah\n";
}
system ("pause");
return 0;
}
- Dengan Hasil Sebagai Berikut :
Tidak ada komentar:
Posting Komentar