0
Do while loop goes infinity
When I use this statement While (res=='N' || res=='n') it goes infinity But when I use this one While (res=='N' && res=='n') It suppose continue looping when variable res is either 'N' or 'n' not 'N' and 'n' Any help with that ? https://code.sololearn.com/c81avN8LDROY/?ref=app
6 Réponses
+ 1
Can you tell the entire params string that you use for executing?
0
KrOW
Char respond;
std::cout<<"Do another one? (y/n) : ";
std::cin>>respond;
}while(respond!='n' && respond!='N');
0
I mean the arguments that you pass to program..
Trying
1 1 n n
i cannot see problems
0
KrOW my code is not well organized, I'm sorry for that.
My code works fine when the while condition is (respond=='N' && respond =='n')
But when the condition becomes (respond=='N' || respond =='n')
The code loops infinitely
Why is that happening?
Isn't or (||)more logical than and(&&)?
0
Are you referring to line 129? I dont understand to which line you referring...
0
KrOW Yes