Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if statements

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi.
i want to say

if ( colour == blue ) or ( colour == green )
{
...
}

why is the top-line wrong,,, how should i write it?

thank you
James
 
Hi

enum color { RED, GREEN, BLUE};

int nColor = 0;

if (( nColor == RED) || ( nColor == GREEN))
AfxMessageBox( "Red or Green");

HTH

Thierry
 
Hello,

These are the main symbols for boolean logic:

OR : ||
AND : &&
Not equal to :   !=
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top