#include<graphics.h>
#include<conio.h>
#include<stdio.h>
int main()
{
float PI = 3.14159;
initgraph(600, 600); //绘制页面
setbkcolor(RGB(128,128,128));
setlinecolor(RED);
cleardevice(); //以背景颜色清空画布
int center_x = 300;
int center_y = 300;
int radius ;
float offset;
float totaloffset=0;
for (radius=200;radius>=0;radius=radius-50)
{
//circle(center_x, center_y, radius); //绘制一个圆
int left = center_x - radius;
int top = center_y - radius;
int right = center_x + radius;
int bottom = center_y + radius;
for (int i = 0; i < 20; i++)
{
offset = i * PI / 10+ totaloffset;
setfillcolor(RGB(0, 240, 220));
solidpie(left, top, right, bottom, offset, 2 * PI / 60 + offset); //绘制一个扇形
setfillcolor(RGB(255, 255, 255));
solidpie(left, top, right, bottom, 2 * PI / 60 + offset, 3 * PI / 60 + offset); //绘制一个扇形
setfillcolor(RGB(200, 0, 0));
solidpie(left, top, right, bottom, 3 * PI / 60 + offset, 5 * PI / 60 + offset); //绘制一个扇形
setfillcolor(RGB(0, 0, 0));
solidpie(left, top, right, bottom, 5 * PI / 60 + offset, 6 * PI / 60 + offset); //绘制一个扇形
}
totaloffset = totaloffset + PI / 20;
}
while (1)
{
}
_getch(); //等待按键输入
closegraph(); //关闭画面
return 0;
}
旋转蛇(画圆、填充圆)—C/C++
最新推荐文章于 2022-10-01 07:32:45 发布