Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- #include <fstream>
- #include <stdlib.h>
- #include <string>
- #include <sstream>
- #include <stdio.h>
- #include <cstdlib>
- using namespace std;
- class A
- {
- private:
- string nazwa_firmy;
- public:
- string tytul;
- string autor;
- int cena;
- int ocena;
- virtual void wysw ()=0;
- virtual void dod ()=0;
- };
- class Czytelnik
- {
- public:
- string imie;
- int wiek;
- int ile_wypozyczen;
- public:
- void wysw()
- {
- cout << "Imie i nazwisko : " << imie << endl;
- cout << "Wiek: " << wiek << endl;
- cout << "Ile wypozyczen: " << ile_wypozyczen << endl;
- }
- void dod()
- {
- string linia;
- getline( cin, linia );
- cout << "Imie i nazwisko : "; getline( cin, imie ); cout << endl;
- cout << "Wiek: "; cin >> wiek; cout << endl;
- cout << "Ile wypozyczen: "; cin >> ile_wypozyczen; cout << endl;
- }
- };
- class Ksiazka : public A
- {
- public:
- int liczba_stron;
- string gatunek;
- string kto;
- A*k;
- public:
- Ksiazka()
- {
- }
- string daj_tytul(string tytul){return tytul;
- }
- void wysw()
- {
- cout << "Tytul ksiazki to: " << tytul << endl;
- cout << "Autor ksiazki to: " << autor<< endl;
- cout << "Gatunek ksiazki to: " << gatunek<< endl;
- cout << "Liczba stron ksiazki to: " << liczba_stron<< endl;
- cout << "Cena ksiazki to: " << cena << " zl"<< endl;
- cout << "Ocena ksiazki to: " << ocena<< endl;
- }
- void dod()
- {
- string linia;
- getline( cin, linia );
- cout << "Tytul ksiazki to: "; getline( cin, tytul ); cout << endl;
- cout << "Autor ksiazki to: "; getline( cin, autor ); cout << endl;
- cout << "Gatunek ksiazki to: "; getline( cin, gatunek ); cout << endl;
- cout << "Liczba stron ksiazki to: "; cin >> liczba_stron; cout << endl;
- cout << "Cena ksiazki to: "; cin >> cena; cout << endl;
- cout << "Ocena ksiazki to: "; cin >> ocena; cout << endl;
- }
- };
- class Plyta : public A
- {
- int liczba_piosenek;
- int dlugosc_piosenek;
- public:
- string kto;
- Plyta()
- {
- }
- Plyta(string t,string a,int c, int o,int l_p,int d_p)
- {
- tytul=t;
- autor=a;
- cena=c;
- ocena=o;
- liczba_piosenek=l_p;
- dlugosc_piosenek=d_p;
- }
- void wysw()
- {
- cout << "Tytul Plyty : " << tytul << endl;
- cout << "Autor Plyty : " << autor << endl;
- cout << "Cena Plyty : " << cena << endl;
- cout << "Ocena Plyty : " << ocena << endl;
- cout << "Liczba piosenek z Plyty : " << liczba_piosenek << endl;
- cout << "Dlugosc piosenek z Plyty : " << dlugosc_piosenek << " minut" << endl;
- }
- void dod()
- {
- string linia;
- getline( cin, linia );
- cout << "Tytul Plyty : "; getline( cin, tytul ); cout << endl;
- cout << "Autor Plyty : "; getline( cin, autor ); cout << endl;
- cout << "Cena Plyty : " ; cin >> cena; cout << endl;
- cout << "Ocena Plyty : "; cin >> ocena; cout << endl;
- cout << "Liczba piosenek z Plyty : "; cin >> liczba_piosenek; cout << endl;
- cout << "Dlugosc piosenek z Plyty : "; cin >> dlugosc_piosenek; cout << endl;
- }
- };
- class Film : public A
- {
- int dlugosc_filmu;
- string gatunek_filmu;
- public:
- string kto;
- Film()
- {
- }
- Film(string t,string a, string g_t, int c, int o, int d_f)
- {
- tytul=t;
- autor=a;
- gatunek_filmu=g_t;
- cena=c;
- ocena=o;
- dlugosc_filmu=d_f;
- }
- void wysw()
- {
- cout << "Tytuł filmu to: " << tytul << endl;
- cout << "Autor filmu to: " << autor << endl;
- cout << "Gatunek filmu to: " << gatunek_filmu << endl;
- cout << "Cena filmu to: " << cena << endl;
- cout << "Ocena filmu to: " << ocena << endl;
- cout << "Dlugosc filmu to: " << dlugosc_filmu << "minut" << endl;
- }
- void dod()
- {
- string linia;
- getline( cin, linia );
- cout << "Tytuł filmu to: "; getline( cin, tytul ); cout << endl;
- cout << "Autor filmu to: "; getline( cin, autor ); cout << endl;
- cout << "Gatunek filmu to: "; getline( cin, gatunek_filmu ); cout << endl;
- cout << "Cena filmu to: "; cin >> cena; cout << endl;
- cout << "Ocena filmu to: "; cin >> ocena; cout << endl;
- cout << "Dlugosc filmu to: "; cin >> dlugosc_filmu; cout << endl;
- }
- };
- int main()
- {
- A *k =new Ksiazka();
- k -> dod();
- k -> wysw();
- A *p = new Plyta();
- p -> dod();
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement