Advertisement
Talar97

[JPO] Kolokwium 2 zad 3 (100%)

May 30th, 2018
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. /*
  2. Napisz program, który tworzy klasę Pracownik, o polach: imię, nazwisko, ulica, nr_domu, kod_pocztowy, miejscowość. Napisać funkcję, która wczytuje dane, oraz funkcję wyświetlającą
  3. */
  4.  
  5. #include <cstdlib>
  6. #include <iostream>
  7. #include <string>
  8.  
  9. using namespace std;
  10.  
  11. class Pracownik{
  12. private:
  13.     string imie, nazwisko, ulica, nr_domu, kod_pocztowy, miejscowosc;
  14. public:
  15.     Pracownik(){}
  16.     void wprowadzDane(){
  17.         cout << "Imie: "; cin >> this->imie;
  18.         cout << "Nazwisko: "; cin >> this->nazwisko;
  19.         cout << "Ulica: "; cin >> this->ulica;
  20.         cout << "Nr domu: "; cin >> this->nr_domu;
  21.         cout << "Kod pocztowy: "; cin >> this->kod_pocztowy;
  22.         cout << "Miejscowosc: "; cin >> this->miejscowosc;
  23.     }
  24.    
  25.     void wyswietlDane(){
  26.         cout << endl <<"Imie: " << this->imie << endl;
  27.         cout << "Nazwisko: " << this->nazwisko << endl;
  28.         cout << "Ulica: " <<  this->ulica << endl;
  29.         cout << "Nr domu: " << this->nr_domu << endl;
  30.         cout << "Kod pocztowy: " <<  this->kod_pocztowy << endl;
  31.         cout << "Miejscowosc: " << this->miejscowosc << endl;
  32.     }
  33. };
  34.  
  35. int main(){
  36.     Pracownik stazysta;
  37.     stazysta.wprowadzDane();
  38.     stazysta.wyswietlDane();
  39.    
  40.     return EXIT_SUCCESS;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement