Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <iostream>
- #include <windows.h>
- using namespace std;
- class postacie
- {
- private:
- int kolor;
- public:
- bool HP;
- int pz;
- void zycieY(bool *poleg);
- void zycieN(bool *poleg);
- void walka (int x, int*, bool*);
- void HOD();
- };
- //****************************************************************************************
- void postacie::walka (int, int *w, bool *poleg)
- {
- if(*w >=1)
- {
- zycieY(bool *poleg);
- }
- else
- {
- zycieN(bool *poleg);
- }
- }
- //***************************************************************************************
- int main()
- {
- int a;
- postacie marek;
- postacie stefan;
- stefan.pz = 100;
- marek.pz = 100;
- cout<<"Ile zycia ma twoja postac? ";
- cin>>a;
- marek.pz = a;
- cout<<"Twoja postac ma "<<marek.pz<<" zycia"<<endl;
- cout<<"Czy twoja postac zyje? "<<endl;
- int *w = &marek.pz;
- bool *poleg = &marek.HP;
- marek.walka (bool x, int *w, bool *poleg);
- if(*poleg==true)
- {
- cout <<"Twoja postac zyje"<<endl;
- }
- {
- cout<<"Zdechles"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment