logical OR || operator

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

[code]
#include
#include


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

Comments

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!

Categories

In this Discussion