#include<iostream>
using namespace std;
void main()
{
int x, y, t;
t = 3;
x = y = 2;
t = x++ || ++y;
cout << "x= " << x << endl;
cout << "y= " << y << endl;
cout << "t= " << t << endl;
system("PAUSE");
}
结果:
x = 3
y = 2
t = 1
|| 逻辑或运算,左式为真右式不会执行。x++为真,y++便不会执行了。