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 I have tried everything, but to do anything looks like. Did you try Not at all! Try it and note that every number is not equal to either 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"); }
(round! = 3 & round! = 5); ?
3 or
5 and therefore always always with the condition
true Code> || .
Comments
Post a Comment