Glenpl

Untitled

Oct 17th, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. #include <conio.h>
  2. #include <iostream>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. class postacie
  8. {
  9. private:
  10.     int kolor;
  11. public:
  12.     bool hp;
  13.     int pz;
  14.     void zycieY(bool *poleg)
  15.     {
  16.  
  17.     }
  18.     void zycieN(bool *poleg)
  19.     {
  20.  
  21.     }
  22.     void walka (int*, bool*);
  23.  
  24.     void HOD();
  25.  
  26.  
  27. };
  28.  
  29. //****************************************************************************************
  30. void postacie::walka (int *w, bool *poleg)
  31. {
  32.     if(*w >=1)
  33.     {
  34.         zycieY(poleg);
  35.     }
  36.     else
  37.     {
  38.         zycieN(poleg);
  39.     }
  40. }
  41. //***************************************************************************************
  42.  
  43. int main()
  44. {
  45.  
  46.     int a;
  47.     postacie marek;
  48.     postacie stefan;
  49.  
  50.     stefan.hp = 100;
  51.     marek.hp = 100;
  52.  
  53.     cout<<"Ile zycia ma twoja postac? ";
  54.     cin>>a;
  55.     marek.pz = a;
  56.     cout<<"Twoja postac ma "<<marek.pz<<" zycia"<<endl;
  57.     cout<<"Czy twoja postac zyje? "<<endl;
  58.  
  59.     int *w = &a;
  60.     bool *poleg = &marek.hp;
  61.  
  62.     marek.walka (w, poleg);
  63.  
  64.     if(*poleg == true)
  65.     {
  66.         cout <<"Twoja postac zyje"<<endl;
  67.     }
  68.     else
  69.     {
  70.         cout<<"Zdechles"<<endl;
  71.     }
  72.  
  73.     return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment