Mega Code Archive

 
Categories / C++ Tutorial / Operators Statements
 

Logical operator keywords

#include <iostream> using std::boolalpha; using std::cout; using std::endl; int main() {    bool a = true;    bool b = false;    int c = 2;    int d = 3;    cout << boolalpha;    cout << "a = " << a << "; b = " << b       << "; c = " << c << "; d = " << d;    cout << "\n\nLogical operator keywords:";    cout << "\n   a and a: " << ( a and a );    cout << "\n   a and b: " << ( a and b );    cout << "\n    a or a: " << ( a or a );    cout << "\n    a or b: " << ( a or b );    cout << "\n     not a: " << ( not a );    cout << "\n     not b: " << ( not b );    cout << "\na not_eq b: " << ( a not_eq b );    return 0; } a = true; b = false; c = 2; d = 3 Logical operator keywords: a and a: true a and b: false a or a: true a or b: true not a: false not b: true a not_eq b: true