c++ - How to add multiple conditions in do-while loop? -


how add both string red , blue in while(). add them

while(color!="red"||"blue");.  

when run code points out error, please me this.

you have 3 problems. first, need this:

while(color!="red" || color!="blue"); 

then remove semi-colon because otherwise you'll have hanging code block.

next, || wrong operator here. should , instead:

while(color!="red" && color!="blue") 

if think logically, need both predicates true. or not appropriate here.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo