Advertisement
JakubJaneczek

3

Oct 28th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. class Pracownik
  7. {
  8.     public:
  9.  
  10.     string imie;
  11.     string nazwisko;
  12.     int wiek;
  13.     char plec;
  14.  
  15.  
  16.     void show(){
  17.     cout<< "Twoje imie to....." <<  imie << endl;
  18.     cout<< "Twoje nazwisko to...." <<  nazwisko << endl;
  19.     cout<< "Twoj wiek to....." <<  wiek << endl;
  20.     cout<< "Twoja plec to....." <<  plec << endl;
  21.  
  22.     }
  23.     void dopisz(string n, string ln, int a, char s) {
  24.         imie=n;
  25.         nazwisko =ln;
  26.         if (a<=18){
  27.             cout << "Błędny wiek pracownika" << endl;
  28.         }
  29.         else {
  30.             cout << "Wszytsko w porządku" << endl;
  31.         }
  32.          plec =s;
  33.     }
  34. };
  35. int main()
  36. {
  37.     Pracownik p1;
  38.     p1.imie="Kuba";
  39.     p1.nazwisko="Kowalski";
  40.     p1.wiek=19;
  41.     p1.plec='m';
  42.  
  43.     p1.show();
  44.     p1.dopisz("Kuba","Kubowski",20,'m');
  45.  
  46.     return 0;
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement