#include <graphics.h>#include <conio.h>void main(){int x,y; initgraph(600,600);for(x=25,y=25;x<=475,y<=475;x+=20,y+=20){setcolor(GREEN);setfillstyle(YELLOW);fillellipse(x,y,25,25);Sleep(500);cleardevice();for (int x=475,y=475;x<=25,y<=25;x-=20,y-=20){setcolor(GREEN);setfillstyle(YELLOW);fillellipse(x,y,25,25);Sleep(500);cleardevice();}}然后一堆錯誤.--------------------配置: mingw5 - CUI Debug, 編譯器類型: MinGW--------------------檢查文件依賴性...正在編譯 G:\程序語言cpp\Debug\圓.cpp...[Error] G:\程序語言cpp\Debug\圓.cpp:4: error: `main' must return `int'[Warning] G:\程序語言cpp\Debug\圓.cpp:5: warning: converting to non-pointer type `int' from NULL[Error] G:\程序語言cpp\Debug\圓.cpp:6: error: stray '\163' in program[Error] G:\程序語言cpp\Debug\圓.cpp:6: error: stray '\187' in program[Error] G:\程序語言cpp\Debug\圓.cpp:6: error: expected `;' before "x"[Error] G:\程序語言cpp\Debug\圓.cpp:6: error: expected `;' before ')' token[Warning] G:\程序語言cpp\Debug\圓.cpp:25:2: warning: no newline at end of file[Error] G:\程序語言cpp\Debug\圓.cpp:25: error: expected `}' at end of input構建中止 圓: 6 個錯誤, 2 個警告
2 回答

守著星空守著你
TA貢獻1799條經驗 獲得超8個贊
1.[Error] G:\程序語言cpp\Debug\圓.cpp:4: error: `main' must return `int'
我學的C++的main()函數都是返回int值得,int main(),你改成這樣最后return 0就可以了
2.[Error] G:\程序語言cpp\Debug\圓.cpp:6: error: stray '\163' in program
[Error] G:\程序語言cpp\Debug\圓.cpp:6: error: stray '\187' in program
這個是出現中文字符了,for(x=25,y=25;x<=475,y<=475;x+=20,y+=20)中的分號是中文符號,改成英文的就可以了
3.[Error] G:\程序語言cpp\Debug\圓.cpp:25: error: expected `}' at end of input你程序的最后少了個"}"
- 2 回答
- 0 關注
- 276 瀏覽