64,648
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
using namespace std;
void main()
{
int a,b,c,d,i;
//两个操作数的情况
i = 0;
a = (i++) + (++i) ;//2
i = 0;
b = (++i) + (i++) ;//2
i=0;
c=(++i) + (++i);//4
i=0;
d=(i++) + (i++);//0
cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl<<endl;
//三个操作数的情况
i = 0;
a = (i++) + (++i) + (++i);//4
i = 0;
b = (++i) + (i++) +(++i);//4
i=0;
c=(++i) + (++i) + (i++);//6
i=0;
d=(++i) + (++i) + (++i);//7
cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl<<endl;
//三个以上操作数的情况
i = 0;
a = (i++) + (++i) + (++i)+(++i);//7
i = 0;
b = (++i) + (i++) +(++i)+(i++);//6
i=0;
c=(++i) + (++i) + (++i)+(i++);//10
i=0;
d=(++i) + (++i) + (++i)+ (++i);//11
cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl<<endl;
i=0;
int sum=(i++)+(++i)+(++i)+(++i)+(i++)+(i++)+(++i);//17
cout<<sum<<endl;
}