Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class pracownik
- {
- public:
- string imie;
- string nazwisko;
- int wiek;
- string plec;
- void wyswietl()
- {
- cout<<imie<<endl;
- cout<<nazwisko<<endl;
- cout<<wiek<<endl;
- cout<<plec<<endl;
- }
- void dopisz()
- {
- cout<<"imie:"<<endl;
- cin>>imie;
- cout<<"nazwisko:"<<endl;
- cin>>nazwisko;
- cout<<"wiek:"<<endl;
- cin>>wiek;
- cout<<"plec"<<endl;
- cin>>plec;
- if (wiek <= 19)
- {
- cout<<"Wiek jest mniejszy niż 19"<<endl;
- }
- };
- };
- int main()
- {
- pracownik P1;
- P1.imie="Dawid";
- P1.nazwisko="Kubiak";
- P1.wiek=19;
- P1.plec='m';
- P1.wyswietl();
- pracownik P2;
- P2.dopisz();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement