// 逻辑运算符 int a = 5; int b = 20; if ( a && b ) { cout << "Line 1 - 条件为真"<< endl ; } if ( a || b ) { cout << "Line 2 - 条件为真"<< endl ; } /* 改变 a 和 b 的值 */ a = 0; b = 10; if ( a && b ) { cout << "Line 3 - 条件为真"<< endl ; } else { cout << "Line 4 - 条件不为真"<< endl ; } if ( !(a && b) ) { cout << "Line 5 - 条件为真"<< endl ; }
标签:逻辑,20,cout,int,C++,运算符 From: https://www.cnblogs.com/itniwota/p/16823385.html