#include<iostream>
using namespace std;
int main()
{
int x1=0;
int x2=0;
int a1,a2;
cout<<"x1="<<x1<<endl;
cout<<"x2="<<x2<<endl;
a1=!x1++;
//先执行!x1,x1=0,x1!=1成立,所以整个式子的值为true=1
a2=!++x2;
//先执行++x2,x2=1,x2!=1不成立,所以整个式子的值为true=0
cout<<"a1="<<a1<<endl;
cout<<"a2="<<a2<<endl;
return 0;
}
运算符优先级及运算次序参考博客
http://www.slyar.com/blog/c-operator-priority.html
同一优先级的运算符,运算次序由结合方向所决定。