Advertisement
Cassimus

zakresy

Mar 5th, 2025
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. // atakuj //attack
  6. int attack(string attacker, string enemy);
  7. // wez_obrazenia// get_damage
  8. void get_damage(int damage, int &hp);
  9.  
  10. int main()
  11. {
  12.     int hp = 100;
  13.     get_damage(attack("Gracz", "Goblin")  , hp);
  14.     cout << "HP: " << hp << endl;
  15.     return 0;
  16. }
  17.  
  18. int attack(string attacker, string enemy)
  19. {
  20.     cout << attacker << " atakuje " << enemy << endl;
  21.     return 5; // wartość ataku
  22. }
  23.  
  24. void get_damage(int damage, int &hp)
  25. {
  26.     hp -= damage;
  27.  
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement