逻辑运算符
作用:用于表达式的值返回真值或假值
逻辑运算符有以下符号
示例:
#include<iostream>
using namespace std;
int main() {
//逻辑运算符 非 ! 真为假,假为真
int a = 10;
cout << !a << endl;
cout << !!a << endl;
//逻辑运算符 与 && 同真为真,其余为假
int b = 10;
int c = 10;
cout << (b&&c) << endl;
b = 0;
c = 10;
cout << (b && c) << endl;
b = 0;
c = 0;
cout << (b && c) << endl;
//逻辑运算符 或 || 同假为假,其余为真
int d =