Hi, I am trying to pick up C++ I started about 2 weeks ago and took on a combat game as practice. Using Visual Studio 2015 to run.
I keep looking, and I feel like my code is logically correct, but it keeps looping. The game will not end, even though I have an if statement declaring a gameOver at the end of the code.
The idea of the game is to input a number of humans, then a number of demons, and the program should spit out who the victor is based off of the variables provided. A random generator is used to determine who hits first and later on again to see if the hit applies (hit or missed attack)(It is a 1-6 just cause I took it off the dice game I was practicing).
Here is my code. If someone could just point me in the right direction I would appreciate it! Thanks!
lines 41,45,57: Do not call srand() within a loop or a random number function. srand() sets the RNG to a particular starting point. Calling srand() repeatedly can cause the RNG to return the same random numbers. srand() should be called ONCE at the beginning of main(). http://www.cplusplus.com/reference/cstdlib/srand/
Line 48, 60: These lines don't do anything and don't make any sense. You're not decrementing HumanHealth or DemonHealth so neither one will go to 0.
Thank you!! I tried it out and I got it out of the looping state. I'm going to keep messing around with it and trying new things out. Big help, thanks again AbstractionAnon and FurryGuy.