Re: Boolean Logic Question
Quote:
Originally posted by Unregistered
Ok... what am I missing? I just don't get why the following code doesn't work. What my code is trying to do is say, 'if the variable is equivalent to a list of possible results, print match. Otherwise, print no match.'
Code:
#include <iostream.h>
#include <stdlib.h>
int main()
{
int x = 5;
if( x == (5 || 3 || 2 || 1 || 0) ) // if (x <= 5 && x != 4) will work
cout << "match" << endl;
else
cout << "no match" << endl;
system("PAUSE");
return 0;
}