zss, а вот и нет

в обоих случая мы выводим значение жизней ГЕРОЯ
C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| while((health_hero>0) || (health_enemy>0))
{
rand_battle=rand() % 3 + 1;
if (rand_battle==1)
{
double damage=health_hero*0.01*(rand()%int(damage_hero*100));
health_hero-=damage;
cout << "Противник ударил вас на " << damage << " очков здоровья" << endl;
//_sleep(500);
cout << "Сейчас у вас " << [COLOR="red"]health_hero[/COLOR] << " очков здоровья" << endl;
cout << "------------------------------" << endl;
//_sleep(1000);
}
else
{
double damage=health_enemy*0.01*(rand()%int(damage_enemy*100));
health_enemy-=damage;
cout << "Вы ударили противника на " << damage << " очков здоровья" << endl;
//_sleep(500);
cout << "Сейчас у него " << [COLOR="Red"]health_hero[/COLOR] << " очков здоровья" << endl;
cout << "------------------------------" << endl;
//_sleep(1000);
}
} |
|