1,前置后置递增递减
a = 10
++a //先让a加1,再进行表达式
a++ //先进行表达式,再让a加1
int a = 2;int b = a++;//a先赋值给b再自加1
cout << b << endl;
cout << a << endl;
int c = ++a;//a先自加1再幅值给c
cout << c << endl;
2,赋值运算符
int a = 2;int b = 4;int c = 4;int d = 4;int e = 4;
b+=a;c-=a;d*=a;e/=a;
cout << b << endl; //b=b+a
cout << c << endl; //c=c-a
cout << d << endl; //d=d*a
cout << e << endl; //e=e/a
return 0;
3,比较运算符(表达式比较,返回一个真值或假值)
== 比较两值是否相等 如4==3(假) 0
!= 不等于 如4 != 3 (真) 1
还有>,<,>=,<=等符号
int a = 2;int b = 4;
cout << (b == a) << endl;//要加小括号
4,与或非
! 非
&& 与
|| 或
int a = 0;int b = 0;
cout << (b || a) << endl;
return 0;