gpt4 book ai didi

c++ - '=' 标记之前的预期主表达式

转载 作者:太空宇宙 更新时间:2023-11-04 15:03:05 24 4
gpt4 key购买 nike

#include <iostream>
using namespace std;
int main (){
int i=2 ,j =3;
int total ;
total + = i--;
cout << total << endl;
return 0;
}

请帮助我,我使用代码块,但我有错误

expected primary expression before '=' token )
in line 6 (total + = i-- )

为什么?

最佳答案

是“+=”而不是“+=”。

这就像你写了“f o o”而不是“foo”。

关于c++ - '=' 标记之前的预期主表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25833380/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com