-1
如何通过打印奇数(1 - > 10) - while?如何打印奇数(1 - > 10) - 而
我的代码:http://codepad.org/yS6DNq8Y
#include <stdio.h>
#include <conio.h>
int i;
void Dayso()
{
do
{
i = 1
i++;
if (i % 2 == 0)
{
continue;
}
printf ("\n%d",i);
}while (i <= 10);
}
int main()
{
Dayso();
getch();
return 0;
}
和输出:
Line 18: error: conio.h: No such file or directory
In function 'Dayso':
Line 10: error: expected ';' before 'i'
我该如何解决这个问题?
错误消息是清楚的方式:开始添加';'在行9.关于错误'18线的端部:错误:CONIO.H:没有这样的文件或目录,[这可能会帮助你] http://stackoverflow.com/questions/8792317/why-cant-i-find-conio-h-on-linux)。 –
在循环体中完成的第一件事是什么(并因此完成每个循环)?为什么这是个问题)? – user2864740
将'i = 1'移至外部作用域并为其添加分号。 –