Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class samochod
  5. {
  6. public:
  7. string marka;
  8. string model;
  9. float pojemnosc;
  10. string kolor;
  11. int rok;
  12. float cena;
  13.  
  14. samochod(string marka, string model, float pojemnosc, string kolor, int rok, float cena)
  15. {
  16. this->marka = marka;
  17. this->model = model;
  18. this->pojemnosc = pojemnosc;
  19. this->kolor = kolor;
  20. this->rok = rok;
  21. this->cena = cena;
  22. }
  23.  
  24. void wysw()
  25. {
  26. cout<<"Marka: "<<marka<<endl;
  27. cout<<"model: "<<model<<endl;
  28. cout<<"pojemnosc: "<<pojemnosc<<endl;
  29. cout<<"kolor: "<<kolor<<endl;
  30. cout<<"rok: "<<rok<<endl;
  31. cout<<"cena: "<<cena<<endl;
  32. }
  33. };
  34.  
  35. class wlasciciel: public samochod
  36. {
  37. public:
  38. string imie;
  39. string nazwisko;
  40. int pesel;
  41. string kod;
  42. string miejscowosc;
  43.  
  44. wlasciciel(string marka, string model, float pojemnosc, string kolor, int rok, float cena,
  45. string imie, string nazwisko, int pesel, string kod, string miejscowosc)
  46. :samochod(marka, model, pojemnosc, kolor, rok, cena)
  47. {
  48. this->imie = imie;
  49. this->nazwisko = nazwisko;
  50. this->pesel = pesel;
  51. this->kod = kod;
  52. this->miejscowosc = miejscowosc;
  53. }
  54.  
  55. void wypisz()
  56. {
  57. cout<<"Marka: "<<marka<<endl;
  58. cout<<"model: "<<model<<endl;
  59. cout<<"pojemnosc: "<<pojemnosc<<endl;
  60. cout<<"kolor: "<<kolor<<endl;
  61. cout<<"rok: "<<rok<<endl;
  62. cout<<"cena: "<<cena<<endl;
  63. cout<<"-----------------------------------"<<endl;
  64. cout<<"imie: "<<imie<<endl;
  65. cout<<"nazwisko: "<<nazwisko<<endl;
  66. cout<<"pesel: "<<pesel<<endl;
  67. cout<<"kod: "<<kod<<endl;
  68. cout<<"miejscowosc: "<<miejscowosc<<endl;
  69. }
  70. };
  71.  
  72. int main() {
  73.  
  74. wlasciciel Osoba("Audi", "A4", 1.6, "Zielony", 1995, 20000,
  75. "Maciej", "Sajkowsky", 795473858, "40-567", "Zadupie");
  76. Osoba.wypisz();
  77.  
  78. return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement