I'm making a quick game where a player can select a move to attack an enemy, and depending on who's health reaches 0 first, wins.
I'm not sure why, but when the player's or enemy's health reaches 0, the loop doesn't immediately end as it should. It gives them one more round despite having 0 health. I have (health > 0) and I tried (health >= 0) but I still get one more loop.
I think changing min health to 20 might resolve this, but then I won't get the health status line to display. Where should I put it so that it shows up one last time when some's health reaches 0? (This line:)
"cout << "Player Health: " << phealth << " ===== VS ===== Opponent Health: " << ophealth << endl;"
I tried again, but am still running into issues. So lost, have no idea what else to try.
Can you advise me on which one of these I got the closest to it working right?