Hello, i'm just getting started into C++ programming and during the course of learning have repeatedly looked to this community as a resource/suppliment for how to program. Ive come to enjoy my time on the tutorials, and browsing your forums and would now like to start getting involved.
Now for my current problem, i've created a small game in order to practice the concepts i've learned, however during my main function I attempt to call a second function called battle() and the program freezes during runtime when the function is supposed to be called (The input cursor blinks after the introduction to the program, and nothing i do allows it to progress.) Theres also an issue with altering the health variables within the battle function, but thats something for me to work on once it stops freezing.
OS = Windows 7
Compiler = Code::Blocks
And now, the source code. (note that i exchanged alot of the narration with single characters to make it shorter.)
while (HP > 0 && lionHP > 0);
This while loop contains no code, so it will run forever.
I expect you meant this line of code to read: while (HP > 0 && lionHP > 0)
Next time this happens, run your code using a debugger and interrupt it when you feel like it; you will be shown the line of code currently being executed and can use that to diagnose such infinite loop problems.