如何从z中减去x和y的总和,然后在C ++中的单个语句中递增它
int main()
{
int x,y,z,p;
x=5;
y=6;
z=20;
p=z-(x+y)++;
cout<<"value of p="<<p;
}
它显示错误为增量操作数所需的值
答案 0 :(得分:1)
Subtract that sum, reduced by 1, using -=
: z -= (x + y - 1)
#include <iostream>
int main()
{
int x, y, z;
x = 5;
y = 6;
z = 20;
z -= (x + y - 1);
std::cout << "value of z=" << z;
}
答案 1 :(得分:0)
#include <iostream>
int main() {
int x,y,f,z;
f=(x=10, y=5, z=20, z-(x+y)+1);
std::cout << "result is = "<<f ;
}
答案 2 :(得分:-1)
增量只是意味着添加1,因此nlist[0][0]
与使用Postfix增量运算符一样有效