Hello everyone. I'm making a small dice rolling game. It's very basic, all text. The problem I'm having with the program right now is: The program doesn't end when either player's health reaches 0. Can someone help me understand why?
*sigh* Thanks for the help everyone. Here is the how it finally ended up working:
while (myhealth > 0 && yourhealth > 0);
Now, I've got a whole new problem. I changed the if statements in the beginning(for entering the correct name) to switch cases, and I was wondering if loops could be embedded in individual cases. Here's what I have so far:
I think I need loops in case 2 and default so that the programs asks for a name again if these options are selected. Am I going in the right direction, or am I way off? Thanks in advance all.
i compiled your code and see that it is not working, but not just in that it is not accepting 0 health for either player
the dice rolls are consistantly the same and have no variation on the amount of health taken from either player...
checking to see if i can find a way to randomize better for you.
Actually, it does stop when a player's health reaches 0, but I see what you mean about the health. It seems to whittle down both players' health equally; i.e. I lose health, you lose health, draw, repeat. It's a little more random than that, but you get the gist of it.
Sorry to double post(can I call bump?) but, could my problem be that I'm reseeding the random number generator every time I type roll? Correct me if I'm wrong, but the "random" number is actually time-based isn't it? I think I'm gonna move srand to the beginning of the program.
EDIT: Crap, never mind. That definitely did NOT work...