Advertisement
Guest User

Untitled

a guest
May 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <windows.h>
  4. #include <fstream>
  5. #include <stdlib.h>
  6. #include <string>
  7. #include <sstream>
  8. #include <stdio.h>
  9. #include <cstdlib>
  10.  
  11.  
  12. using namespace std;
  13. class A
  14. {
  15. private:
  16. string nazwa_firmy;
  17. public:
  18. string tytul;
  19. string autor;
  20. int cena;
  21. int ocena;
  22.  
  23.  
  24. virtual void wysw ()=0;
  25. virtual void dod ()=0;
  26.  
  27.  
  28. };
  29.  
  30. class Czytelnik
  31. {
  32. public:
  33. string imie;
  34. int wiek;
  35. int ile_wypozyczen;
  36. public:
  37. void wysw()
  38. {
  39.  
  40. cout << "Imie i nazwisko : " << imie << endl;
  41. cout << "Wiek: " << wiek << endl;
  42. cout << "Ile wypozyczen: " << ile_wypozyczen << endl;
  43. }
  44. void dod()
  45. {
  46. string linia;
  47. getline( cin, linia );
  48. cout << "Imie i nazwisko : "; getline( cin, imie ); cout << endl;
  49. cout << "Wiek: "; cin >> wiek; cout << endl;
  50. cout << "Ile wypozyczen: "; cin >> ile_wypozyczen; cout << endl;
  51. }
  52. };
  53. class Ksiazka : public A
  54. {
  55. public:
  56. int liczba_stron;
  57. string gatunek;
  58. string kto;
  59. A*k;
  60. public:
  61. Ksiazka()
  62. {
  63. }
  64.  
  65. string daj_tytul(string tytul){return tytul;
  66. }
  67. void wysw()
  68. {
  69.  
  70. cout << "Tytul ksiazki to: " << tytul << endl;
  71. cout << "Autor ksiazki to: " << autor<< endl;
  72. cout << "Gatunek ksiazki to: " << gatunek<< endl;
  73. cout << "Liczba stron ksiazki to: " << liczba_stron<< endl;
  74. cout << "Cena ksiazki to: " << cena << " zl"<< endl;
  75. cout << "Ocena ksiazki to: " << ocena<< endl;
  76.  
  77. }
  78. void dod()
  79. {
  80. string linia;
  81. getline( cin, linia );
  82. cout << "Tytul ksiazki to: "; getline( cin, tytul ); cout << endl;
  83. cout << "Autor ksiazki to: "; getline( cin, autor ); cout << endl;
  84. cout << "Gatunek ksiazki to: "; getline( cin, gatunek ); cout << endl;
  85. cout << "Liczba stron ksiazki to: "; cin >> liczba_stron; cout << endl;
  86. cout << "Cena ksiazki to: "; cin >> cena; cout << endl;
  87. cout << "Ocena ksiazki to: "; cin >> ocena; cout << endl;
  88. }
  89. };
  90. class Plyta : public A
  91. {
  92. int liczba_piosenek;
  93. int dlugosc_piosenek;
  94. public:
  95. string kto;
  96. Plyta()
  97. {
  98. }
  99. Plyta(string t,string a,int c, int o,int l_p,int d_p)
  100. {
  101.  
  102. tytul=t;
  103. autor=a;
  104. cena=c;
  105. ocena=o;
  106. liczba_piosenek=l_p;
  107. dlugosc_piosenek=d_p;
  108. }
  109. void wysw()
  110. {
  111. cout << "Tytul Plyty : " << tytul << endl;
  112. cout << "Autor Plyty : " << autor << endl;
  113. cout << "Cena Plyty : " << cena << endl;
  114. cout << "Ocena Plyty : " << ocena << endl;
  115. cout << "Liczba piosenek z Plyty : " << liczba_piosenek << endl;
  116. cout << "Dlugosc piosenek z Plyty : " << dlugosc_piosenek << " minut" << endl;
  117. }
  118. void dod()
  119. {
  120. string linia;
  121. getline( cin, linia );
  122. cout << "Tytul Plyty : "; getline( cin, tytul ); cout << endl;
  123. cout << "Autor Plyty : "; getline( cin, autor ); cout << endl;
  124. cout << "Cena Plyty : " ; cin >> cena; cout << endl;
  125. cout << "Ocena Plyty : "; cin >> ocena; cout << endl;
  126. cout << "Liczba piosenek z Plyty : "; cin >> liczba_piosenek; cout << endl;
  127. cout << "Dlugosc piosenek z Plyty : "; cin >> dlugosc_piosenek; cout << endl;
  128. }
  129. };
  130. class Film : public A
  131. {
  132. int dlugosc_filmu;
  133. string gatunek_filmu;
  134. public:
  135. string kto;
  136. Film()
  137. {
  138. }
  139. Film(string t,string a, string g_t, int c, int o, int d_f)
  140. {
  141. tytul=t;
  142. autor=a;
  143. gatunek_filmu=g_t;
  144. cena=c;
  145. ocena=o;
  146. dlugosc_filmu=d_f;
  147. }
  148. void wysw()
  149. {
  150. cout << "Tytuł filmu to: " << tytul << endl;
  151. cout << "Autor filmu to: " << autor << endl;
  152. cout << "Gatunek filmu to: " << gatunek_filmu << endl;
  153. cout << "Cena filmu to: " << cena << endl;
  154. cout << "Ocena filmu to: " << ocena << endl;
  155. cout << "Dlugosc filmu to: " << dlugosc_filmu << "minut" << endl;
  156. }
  157. void dod()
  158. {
  159. string linia;
  160. getline( cin, linia );
  161. cout << "Tytuł filmu to: "; getline( cin, tytul ); cout << endl;
  162. cout << "Autor filmu to: "; getline( cin, autor ); cout << endl;
  163. cout << "Gatunek filmu to: "; getline( cin, gatunek_filmu ); cout << endl;
  164. cout << "Cena filmu to: "; cin >> cena; cout << endl;
  165. cout << "Ocena filmu to: "; cin >> ocena; cout << endl;
  166. cout << "Dlugosc filmu to: "; cin >> dlugosc_filmu; cout << endl;
  167. }
  168. };
  169. int main()
  170. {
  171. A *k =new Ksiazka();
  172. k -> dod();
  173. k -> wysw();
  174. A *p = new Plyta();
  175. p -> dod();
  176.  
  177.  
  178. return(0);
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement