结构问题"for"
problems with the structure "for"
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,a=4, b=3;
for (i=0, i<3, i++)
{
if (b%2==0)
{
printf("%d+%d=%d", a, b, a+b);
i++;
}
b++
}
system("pause");
return 0;
}
我需要帮助!每次我放它时,它都用 for 来表示:
8 个预期的';'在')'标记之前"
我不知道该怎么办,请帮忙!!
你应该
在循环声明中使用;
而不是,
像这样:
for (i=0; i<3; i++) {
}
这是因为for
的三个部分用分号而不是逗号分隔:
for (i=0 ; i<3 ; i++)
// ^ ^
在 C/C++ 中,使用 ;
分隔 for (...)
语句中的循环条件。
请改用这个:
for (i = 0; i < 3; i++) {
...
}
您使用了
逗号而不是分号
for(int i = 0; i != 3; ++i)
{
//code here
}
相关文章:
- 在 for 循环中查找问题时遇到困难
- 嵌套for循环C++的问题(初学者)
- 遇到此问题时遇到困难:允许用户输入数组的值并使用 for,而循环也输出输入的最大数字
- OpenMP for 循环并行性问题
- 在 for 循环中更新两个变量时遇到问题C++
- 在C++中验证for循环的问题
- C++:关于for语句和参数的一般问题
- C++编译Qt for Visual Studio 2017的问题
- 关于 for 循环中的 *p 和 p 的问题
- 调用模板函数的问题"No matching function for call"参数:迭代器、对象函数
- 如何在 for 循环中解决潜在的 getline() 问题,数组的第一个索引没有显示?
- 模板和 for 循环出现问题
- 如何编译 node.js for CentOS 6.10 (库问题)
- R6010 执行后出错.if 语句在 for 循环中.[作业][中止已解决,发现新问题]
- 如何在 for 循环中解决逐一关闭的问题
- openMp的多个独立for循环的性能问题
- 对简单的帐户检查程序有问题?程序返回编译错误,指出"no match for 'operator||' unsure of how to fix?"
- C OpenMP for-loop全局可变问题
- 基于范围的 for 循环的对象生存期问题
- For 循环 c++ 的问题