Advertisement
MeehoweCK

Untitled

Nov 24th, 2020
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. class Kandydat
  7. {
  8.     string imie;
  9.     string nazwisko;
  10.     unsigned id;
  11.     unsigned liczba_glosow;
  12. public:
  13.     Kandydat(string, string, unsigned);
  14.     void dodaj_glosy(unsigned);
  15.     void wypisz_dane();
  16. };
  17.  
  18. Kandydat::Kandydat(string name, string scndname, unsigned ident) : imie(name), nazwisko(scndname), id(ident), liczba_glosow(0) {}
  19.  
  20. void Kandydat::dodaj_glosy(unsigned ile)
  21. {
  22.     liczba_glosow += ile;
  23. }
  24.  
  25. void Kandydat::wypisz_dane()
  26. {
  27.     cout << id << ' ' << imie << ' ' << nazwisko << "\t\tliczba glosow: " << liczba_glosow << endl;
  28. }
  29.  
  30. class Okreg
  31. {
  32.     unsigned nr_okregu;
  33.    
  34.  
  35. };
  36.  
  37. int main()
  38. {
  39.     Kandydat nowy("Adam", "Kowalski", 1);
  40.     nowy.dodaj_glosy(500);
  41.     nowy.dodaj_glosy(1000);
  42.     nowy.wypisz_dane();
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement