For some reason the if statements at lines 52 and 109 are ignored. Also in the battle function, the enemyH = enemyH - atk; does nothing. How should i fix this?
I've not actually tested/parsed the code but I'm sure you must clear the buffer with the cin.ignore(); function, before the cin statements, which come before the if statements.
and perform the same functionality. With that change, it should work as expected, though I am not 100% sure.
As for your other problem, the one concerning the disregard for the two if statements, you use cin in order to obtain a name of a pet. However, all of the pets have a name which includes a space. When you use cin, it only goes up to the first instance of you hitting the space key, so the second half of the pet name is still in the "input buffer." When you get to the next cin statement, that previous input is included, thus nulling out the if statements. You can test this by placing an else statement, which consists of an error message. I would recommend using getline instead of cin in all instances of cin in your code.