-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'移至外部作用域併爲其添加分號。 –