++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;
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;
== 比较两值是否相等 如4==3(假) 0
!= 不等于 如4 != 3 (真) 1
还有>,<,>=,<=等符号
int a = 2;int b = 4; cout << (b == a) << endl;//要加小括号
! 非
&& 与
|| 或
int a = 0;int b = 0; cout << (b || a) << endl; return 0;