c - Issue with do while loop -


I have participated in a problem while looping for a rock, paper, scissors game that I have written. It never breaks out of the loop. I have tried to do everything, but nothing seems to work. Everything seems logical, but maybe I'm missing something, do anyone have any suggestions? Although I understand that adding a break to each if statement is a simple improvement, I should understand why loop itself does not work.

  #include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; Int main () {int round, win, max; Do {printf ("3 out of the best 2 or 3 out of 3 best? (3 or 5 enter) \ n"); Scanf_s ("% d", and round); Printf ("% d \ n \ n", round); If (round == 3) {win = 2; Max = 3; Say ("OK!"); } And if (round == 5) {win = 3; Max = 5; Say ("\ NOK!"); } Else {printf ("Please enter a valid option. \ N \ n"); }} While (round! = 3 || round! = 5); System ("pause"); }    

I have tried everything, but to do anything looks like.

Did you try (round! = 3 & round! = 5); ?

Not at all! Try it and note that every number is not equal to either 3 or 5 and therefore always always with the condition true Code> || .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -