SHARE
TWEET

Untitled

a guest Sep 21st, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class Czlowiek
  7. {
  8. private:
  9.     string plec, obywatelstwo, imie;
  10.     int waga, wzrost;
  11. public:
  12.     Czlowiek(string plec = "M", string obywatelstwo = "Polskie", string imie = "Jan", int wzrost = 180, int waga = 75)
  13.     {
  14.         this->plec = plec;
  15.         this->obywatelstwo = obywatelstwo;
  16.         this->imie = imie;
  17.         this->wzrost = wzrost;
  18.         this->waga = waga;
  19.     }
  20.     string return_plec()
  21.     {
  22.         return plec;
  23.     }
  24.     string return_obywatelstwo()
  25.     {
  26.         return obywatelstwo;
  27.     }
  28.     string return_imie()
  29.     {
  30.         return imie;
  31.     }
  32.     int return_wzrost()
  33.     {
  34.         return wzrost;
  35.     }
  36.     int return_waga()
  37.     {
  38.         return waga;
  39.     }
  40.  
  41.     void pokaz()
  42.     {
  43.         cout << "Osoba plsci: " << plec << " o imieniu " << imie << " ma obywatelstwo " << obywatelstwo << " wazy " << waga << " i ma " << wzrost << " cm wzrostu" << endl;
  44.     }
  45. };
  46.  
  47. Czlowiek *znajdz(Czlowiek * tab)
  48. {
  49.     Czlowiek * tabwyniki[7];
  50.     int tablen = 0;
  51.     for (int i = 0; i < 7; i++)
  52.     {
  53.         if (tab[i].return_plec() == "K" && tab[i].return_wzrost() >= 170)
  54.         {
  55.             tabwyniki[tablen] = &tab[i];
  56.             tablen++;
  57.         }
  58.     }
  59.     return *tabwyniki;
  60. }
  61.  
  62. int main()
  63. {
  64.     Czlowiek tab[7] = { {"M", "Niemieckie", "Gunter", 178, 95}, {"K","Fracuskie","Cloe",173,56}, {"K","Angielskie","Alice",165,65}, {"M","Ukrainskie","Piotr", 189, 84}, {"M","Polskie","Grzegorz", 180, 70}, {"K","Hiszpanskie","Miriam", 169, 69}, {"M","Polskie","Kacper",165,70} };
  65.     //tab[0].pokaz();
  66.     system("pause");
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top