Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人可以向我解释为什么我不能 5 到我吗?每次我尝试编译时,我都会收到一个错误,说它不是一个语句。
for (int i = 0; i < s; i+5) { }
i + 5单独不修改i。你仍然需要改变i:
i + 5
i
for (int i = 0; i < s; i += 5) {
@Blender 建议的另一种方法是:
for (int i = 0; i < s; i=i+5) { }
i 的值不会增加 i+5。试试这个
for (int i=0;i<s ;i=i+5 ){ }
或者
for(int i=0;i<s;i+=5){ }