令牌之前的预期主表达式'='
expected primary expression before '=' token
#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"一样。
你需要去掉+
和=
之间的空格:
total += i--;
相关文章:
- holeMenuProgram.cpp:38:1 错误:'}'令牌之前的预期主表达式
- (错误:令牌之前'<<'预期的主表达式)
- 错误:C++中']'令牌之前的预期主表达式
- 错误:令牌之前的预期主表达式'&&'
- 令牌之前']'预期的主表达式?
- 错误:令牌之前的预期主表达式'/'
- 正则表达式使用提升令牌迭代器在单引号和括号之间提取值
- 令牌之前')'预期的主表达式(需要"template"消除歧义器)
- 错误:令牌之前的预期主表达式'<':Arduino RGB 舞灯
- 令牌之前出现错误')'主表达式
- C++错误:错误:令牌之前的预期主表达式'||'
- 令牌问题之前'*'预期的主表达式
- 令牌之前的预期表达式']'?C
- 退出状态 1 令牌之前的预期主表达式'.'
- C++错误:";"之前应为主表达式使用Cmake的令牌
- 向量空Push_back在令牌之前调用'{'预期的主表达式
- 令牌调用之前'...'预期的主表达式 模板化类的模板化方法
- 错误 预期主表达式在 ';" 之前令牌 C++
- 令牌之前的预期主表达式'-'
- 令牌之前的预期主表达式'<'