Advertisement
PiotrJurek

Zad4

Nov 19th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Pracownik
  6. {
  7. private:
  8.     string imie;
  9.     string nazwisko;
  10.     int wiek;
  11.     char plec;
  12.  
  13. public:
  14.     Pracownik(string im = "Brak", string naz = "Brak", int w = 0, char p = 'n') : imie(im), nazwisko(naz), wiek(w), plec(p)
  15.     {
  16.         wyswietl();
  17.     };
  18.     wyswietl()
  19.     {
  20.         cout << "Imie: " << imie << endl;
  21.         cout << "Nazwisko: " << nazwisko << endl;
  22.         cout << "Wiek: " << wiek << endl;
  23.         cout << "Plec: " << plec << endl;
  24.     }
  25.  
  26. };
  27.  
  28. int main()
  29. {
  30.     Pracownik piekarz;
  31.     Pracownik kucharz("Jan", "Kowalski", 40, 'm');
  32.     return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement