Glenpl

Untitled

Oct 17th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 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.     void zycieN(bool *poleg);
  16.     void walka (int x, int*, bool*);
  17.  
  18.     void HOD();
  19.  
  20.  
  21. };
  22.  
  23. //****************************************************************************************
  24. void postacie::walka (int, int *w, bool *poleg)
  25. {
  26.     if(*w >=1)
  27.     {
  28.         zycieY(bool *poleg);
  29.     }
  30.     else
  31.     {
  32.         zycieN(bool *poleg);
  33.     }
  34. }
  35. //***************************************************************************************
  36.  
  37.  
  38. int main()
  39. {
  40.  
  41.     int a;
  42.     postacie marek;
  43.     postacie stefan;
  44.  
  45.     stefan.pz = 100;
  46.     marek.pz = 100;
  47.  
  48.     cout<<"Ile zycia ma twoja postac? ";
  49.     cin>>a;
  50.     marek.pz = a;
  51.     cout<<"Twoja postac ma "<<marek.pz<<" zycia"<<endl;
  52.     cout<<"Czy twoja postac zyje? "<<endl;
  53.  
  54.     int *w = &marek.pz;
  55.     bool *poleg = &marek.HP;
  56.  
  57.     marek.walka (bool x, int *w, bool *poleg);
  58.  
  59.  
  60.     if(*poleg==true)
  61.     {
  62.         cout <<"Twoja postac zyje"<<endl;
  63.     }
  64.  
  65.     {
  66.         cout<<"Zdechles"<<endl;
  67.     }
  68.  
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment