C++ and Boolean Operators
Hello, I've recently taken on interest in C++, planning to start college and eventually aim for CS degree. Anyways, I've been checking out the tutorials and I have been trying to write a simple code using Boolean Operators.
I kind of understand the concept but there are no actual examples in the tutorials with Boolean Operators so I'm having a tough time with this code:
Code:
#include <iostream>
using namespace std;
int main()
{
int a;
cout<<"I am thinking of a number from 1 to 15.\n";
cin>> a;
cin.ignore();
if ( a == 3 && 7 ){
cout<<"That is correct!";
}
else if ( a == !(3 && 7) ){
cout<<"Try again.";
}
cin.get();
}
When I input 3 it recognizes as TRUE but if I input 7 or any other number, I don't neither of the IF or ELSE IF statements.