Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- #include <iostream>
- #include <iomanip>
- #include <string.h>
- inline void baris();
- void tampil();
- int tarif (char kobu[], char jebu[], int bapin, int *jumbay, int *tabu);
- main()
- {
- char nama[30], kobu[2], jebu[30];// kobu = kode buku, jebu = jenis buku
- int tabu=0, jumbay=0, bapin=0;// tabu = tarif buku, jumbay = jumlah bayar, bapin = banyak pinjam
- cout<<"by : dedi susanto"<<endl<<endl;
- tampil();
- cout<<endl<<endl<<"\t\t\tPerpusatakaan Kecil-kecilan"<<endl;
- cout<<"---------------------------"<<endl;
- cout<<"Nama Penyewa Buku\t : ";cin.getline(nama,30);
- cout<<"Kode Buku [C/K/N]\t : ";cin>>kobu;
- cout<<"Banyak Pinjam\t\t : ";cin>>bapin;
- tarif(kobu, jebu, bapin, &jumbay, &tabu);
- system("cls");
- cout<<"Tarif Sewa\t\t\t : Rp. "<<tabu<<endl;
- cout<<"Jenis Buku\t\t\t : "<<jebu<<endl;
- cout<<"Penyewa dengan Nama\t\t : "<<nama<<endl;
- cout<<"Jumlah Bayar Penyewaan Sebesar\t : Rp. "<<jumbay<<endl;
- }
- void baris()
- {
- cout<<setfill('-')<<setw(70)<<"-"<<endl<<setfill(' ');
- }
- void tampil()
- {
- baris();
- cout<<setiosflags(ios::left)<<setw(20)<<"| Kode Jenis Buku";
- cout<<setw(35)<<"| jenis Buku"<<setw(15)<<"| Tarif Buku"<<"|"<<endl;
- baris();
- cout<<setw(20)<<"| C"<<setw(35)<<"| CerPen (Kumpulan Cerita Pendek)";
- cout<<setw(15)<<"| 500"<<"|"<<endl;
- baris();
- cout<<setw(20)<<"| K"<<setw(35)<<"| Komik";
- cout<<setw(15)<<"| 700"<<"|"<<endl;
- baris();
- cout<<setw(20)<<"| N"<<setw(35)<<"| Novel";
- cout<<setw(15)<<"| 1000"<<"|"<<endl;
- baris();
- }
- int tarif (char kobu[], char jebu[], int bapin, int *jumbay, int *tabu)
- {
- if(strcmp(strupr(kobu),"C")==0)
- {
- strcpy(jebu,"CerPen (Kumpulan Cerita Pendek)");
- *tabu=500;
- }
- else if(strcmp(strupr(kobu),"K")==0)
- {
- strcpy(jebu,"Komik");
- *tabu=700;
- }
- else if(strcmp(strupr(kobu),"N")==0)
- {
- strcpy(jebu,"Novel");
- *tabu=1000;
- }
- else
- {
- strcpy(jebu,"-");
- *tabu=0;
- }
- *jumbay=*tabu * bapin;
- }
Add Comment
Please, Sign In to add comment