C++ examples for Operator:Logical Operator
Logical || operator determines if either or both of the statements used are true.
#include <iostream> using namespace std; int main(int argc, char* argv[]) { bool isTrue { (1 == 1) || (0 == 1) }; cout << "True? " << isTrue << endl; isTrue = (0 == 1) || (1 == 1);//from ww w .ja v a2 s. co m cout << "True? " << isTrue << endl; isTrue = (1 == 1) || (1 == 1); cout << "True? " << isTrue << endl; isTrue = (0 == 1) || (1 == 0); cout << "True? " << isTrue << endl; return 0; }