代码:
#include <graphics.h>
#include <conio.h>
int main()
{
start:
// 初始化绘图窗口
initgraph(640, 480);
setfillcolor(0xAA0000);
char key;
wchar_t s[10]; // 定义字符串缓冲区,并接收用户输入
InputBox(s, 10, L"请输入圆的半径:");
// 将用户输入转换为数字
int r = _wtoi(s);
// 画圆
fillcircle(320, 240, r);
while (1)
{
key = _getch();
switch (key)
{
case '\r':
case '\n':
goto start;
}
}
closegraph();
return 0;
}
运行结果: