Hi, I'm quite new to cpp programming, and I made this small script using Dev-C++.
Code:
#include <iostream>
using namespace std;
int main()
{
int x;
cout<<"Enter 1 or 0: ";
cin>>x;
cin.ignore();
if ( x = ( 1 || 0 ) ) {
cout<<"Hello World";
}
else if ( x = ( 1 && 0 ) ) {
cout<<"World Hello";
}
cin.get();
}
Problem here is, if I enter 0, it should be printing World Hello instead of Hello World, which doesn't happens. Ofcourse I could easily solve this by adding a NOT operator, but I want to know about the AND and OR operators in specific. Could someone help me out?