旋转蛇(画圆、填充圆)—C/C++

#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;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值