Program won't follow loop parameters....?

...
Last edited on
I don't know if it will solve all of your problems but in your RPS function for your if statements you should be using == not =. I am guessing that no matter what you put in for the user selection will result in a tie.
 
if (User_Selection == 'r' || 'p' || 's')


You are only comparing User_Selection to 'r' in this statement. I'm not sure what just 'p' and 's' evaluate to code-wise but it is not a comparison with User_Selection
Thanks MrGoat! I fixed that part. Texan40, doesn't the "||" mean or? I wanted the statement to mean "if User_Selection is equal to 'r' OR 'p' OR 's'. Is that flawed?
Last edited on
if (User_Selection == 'r' || 'p' || 's')

means if

User_Selection == 'r'

or if

'p' //basically if 'p' is not NULL, which it isn't

or if

's' //basically if 's' is not NULL, which it isn't


The correct way is

if (User_Selection == 'r' || User_Selection == 'p' || User_Selection == 's')

That's exactly what the problem was. Didn't realize that I needed to continue to restate it. Thanks fg109!
Topic archived. No new replies allowed.