1 #include <WINDOWS.H> 2 #include <IOSTREAM> 3 4 using namespace std; 5 6 int main() 7 { 8 9 int a = 5; 10 int b = 10; 11 int c = 10; 12 13 //不短路或,两个条件都判断 14 if (a > 4 | b++ > 10) 15 { 16 cout << a << endl << b << endl; 17 } 18 19 cout<<"/*****************/"<<endl; 20 21 //短路或,若第一个条件满足则直接进入,不走第二个条件 22 if (a > 4 || c++ > 10) 23 { 24 25 cout << a << endl << c << endl; 26 } 27 28 return 0; 29 }