logical OR || operator

Why does the following code never exit the loop when the correct string is entered?


int main()
std::string myString = "";
while( (myString!="one") || (myString!="two") )
cout << "enter the word one or two: ";
cin >> myString;
return 0;


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion