#include <iostream>
#include <iostream>
class Battle {
private:
int my_hp;
int my_Recovery_limit;
int monster_hp;
int monster_Recovery_limit;
public:
Battle(int my, int monster)
: my_hp(my),
my_Recovery_limit(my),
monster_hp(monster),
monster_Recovery_limit(monster) {}
void MyAttack(int k) {
monster_hp -= k;
if (monster_hp <= 0) {
monster_hp = 0;
std::cout << "You win!" << std::endl;
}
}
void MyRecovery(int k) {
my_hp += k;
if (my_hp >= my_Recovery_limit) {
my_hp = my_Recovery_limit;
}
}
void MonsterAttack(int k) {
my_hp -= k;
if (my_hp <= 0) {
my_hp = 0;
std::cout << "Monster wins!" << std::endl;
}
}
void MonsteRecovery(int k) {
monster_hp += k;
if (monster_hp >= monster_Recovery_limit) {
monster_hp = monster_Recovery_limit;
}
}
void Status() const {
std::cout << "My HP: " << my_hp
<< " | Monster HP: " << monster_hp
<< std::endl;
}
};
int main() {
std::cout << "Hello world!" << std::endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: