Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- void atak_smoka(int &a, int b)
- {
- int procent;
- procent=b*5;
- procent/=100;
- a=a-procent;
- }
- void luk(int &a)
- {
- a=a-50;
- }
- void topor(int &a, int&b)
- {
- a=a-15;
- b=b-150;
- }
- void fireball(int &a, int&b)
- {
- a=a-40;
- b=b-400;
- }
- void lekarstwo(int &a)
- {
- a=a+40;
- }
- void stan(int a, int b)
- {
- cout<<"masz "<<a<<" "<<"hp! "<<endl;
- cout<<"smok ma "<<b<<" "<<"hp! "<<endl;
- }
- int main()
- {
- int hp1=100,hp2=1000,i=4;
- int wybor;
- cout << "=========================================" << endl;
- cout << "Witaj w grze Darwin vs Dragon, masz 100hp"<< endl<< "Twoj przeciwnik 1000! powodzenia! " << endl;
- cout << "=========================================" << endl;
- cout <<" "<< endl;
- stan(hp1,hp2);
- while(hp1>0 && hp2>0)
- {
- cout<<endl;
- cout<<endl;
- cout<<"fireball atak [1]"<<endl;
- cout<<"topor atak [2]"<<endl;
- cout<<"luk atak [3]"<<endl;
- cout<<"lekarstwo uzyj [4]"<<endl;
- cout<<"wybierz: ";
- cin>>wybor;
- cout<<endl;
- switch(wybor)
- {
- case 1:
- system( "cls" );
- fireball(hp1,hp2);
- atak_smoka(hp1,hp2);
- stan(hp1,hp2);
- cout<<"uzyles fireball! "<<endl;
- break;
- case 2:
- system( "cls" );
- topor(hp1,hp2);
- atak_smoka(hp1,hp2);
- stan(hp1,hp2);
- cout<<"uzyles topor! "<<endl;
- break;
- case 3:
- system( "cls" );
- luk(hp2);
- atak_smoka(hp1,hp2);
- stan(hp1,hp2);
- cout<<"uzyles luk! "<<endl;
- break;
- case 4:
- while(i!=0)
- {
- system( "cls" );
- lekarstwo(hp1);
- atak_smoka(hp1,hp2);
- stan(hp1,hp2);
- cout<<"uzyles lekarstwa! "<<endl;
- i--;
- break;
- }
- cout<<"Nie masz juz leczenia! "<<endl;
- }
- if(hp1<=0)
- {
- system("cls");
- cout<<"Przegrales";
- cout<<endl;
- }
- else if(hp2<=0)
- {
- system("cls");
- cout<<"Wygrales";
- cout<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement