#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
class buku
{ private:
char judul[35];
char pengarang[25];
long harga;
public:
buku (char *judul, char *pengarang, long harga);
void info_buku(); };
class disket
{ private:
char ukuran [25];
long harga;
public:
disket(char *ukuran, long harga);
void info_disket();
};
class paketbukudisket : public buku, public disket
{ private:
long harga;
public:
paketbukudisket(char *judul, char *pengarang, long harga_buku, char *ukuran, long harga_disk);
void info_paket();
};
int main()
{ paketbukudisket cpp("C++", "Alakadabra", 25000, "3 1/2 inci", 12000);
cpp.info_paket(); }
buku::buku(char*judul, char *pengarang, long harga)
{ strcpy(buku::judul, judul);
strcpy(buku::pengarang, pengarang);
buku::harga=harga; }
void buku::info_buku()
{ cout<<" Judul buku : "<<judul<<endl;
cout<<" Pengarang : "<<pengarang<<endl;
cout<<" Harga buku : "<<harga<<endl; }
disket::disket(char *ukuran, long harga)
{ strcpy(disket::ukuran, ukuran);
disket::harga = harga; }
void disket::info_disket()
{ cout<<" Ukuran disket : "<<ukuran<<endl;
cout<<" Harga disket : "<<harga<<endl; }
paketbukudisket::paketbukudisket(char *judul, char *pengarang, long harga_buku, char *ukuran, long harga_disket):
buku(judul, pengarang, harga_buku),disket(ukuran, harga_disket)
{ harga = harga_buku + harga_disket; }
void paketbukudisket::info_paket()
{ info_buku();
info_disket();
cout<<" Harga Total : "<<harga<<endl;
getch(); }
#include<conio.h>
#include<string.h>
using namespace std;
class buku
{ private:
char judul[35];
char pengarang[25];
long harga;
public:
buku (char *judul, char *pengarang, long harga);
void info_buku(); };
class disket
{ private:
char ukuran [25];
long harga;
public:
disket(char *ukuran, long harga);
void info_disket();
};
class paketbukudisket : public buku, public disket
{ private:
long harga;
public:
paketbukudisket(char *judul, char *pengarang, long harga_buku, char *ukuran, long harga_disk);
void info_paket();
};
int main()
{ paketbukudisket cpp("C++", "Alakadabra", 25000, "3 1/2 inci", 12000);
cpp.info_paket(); }
buku::buku(char*judul, char *pengarang, long harga)
{ strcpy(buku::judul, judul);
strcpy(buku::pengarang, pengarang);
buku::harga=harga; }
void buku::info_buku()
{ cout<<" Judul buku : "<<judul<<endl;
cout<<" Pengarang : "<<pengarang<<endl;
cout<<" Harga buku : "<<harga<<endl; }
disket::disket(char *ukuran, long harga)
{ strcpy(disket::ukuran, ukuran);
disket::harga = harga; }
void disket::info_disket()
{ cout<<" Ukuran disket : "<<ukuran<<endl;
cout<<" Harga disket : "<<harga<<endl; }
paketbukudisket::paketbukudisket(char *judul, char *pengarang, long harga_buku, char *ukuran, long harga_disket):
buku(judul, pengarang, harga_buku),disket(ukuran, harga_disket)
{ harga = harga_buku + harga_disket; }
void paketbukudisket::info_paket()
{ info_buku();
info_disket();
cout<<" Harga Total : "<<harga<<endl;
getch(); }
No comments:
Post a Comment