⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2-2.c

📁 小试验
💻 C
字号:
#include<graphics.h>/*加入c图形库*/
#include<math.h>/*数学库*/
#include<conio.h>/*键盘控制*/
void MidpointCircle( int r,int value)
{
	float x,y,d,deltaE,deltaSE;
	x=0; y=r; d=1-r;deltaE=3;deltaSE=2.5-r;
	putpixel(x,y,value);
	while(x<y)
	{
		if(getch()==17)exit();/*读入键盘按键*/
		if(d<0)
		{
			d+=deltaE;
			deltaE+=2;deltaSE++;
			x++;
		}
		else
		{
			d+=deltaSE+deltaSE;
			deltaE+=2; deltaSE+=2;
			x++;
			y--;
		}
		putpixel(x,y,value);
	}
}

void main()
{
int i,driver,mode;
driver=DETECT;/*初始化显示模式参数*/
initgraph(&driver,&mode,"..\\bgi");/*初始化显示为默认驱动的640*480、16色模式*/
printf("Press any key to continue except 'Ctrl+Q' to quit.\n");
MidpointCircle( 400,15);/*设置半径为400,颜色为15*/
closegraph();/*关闭图形模式*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -