C/C++ Graphics program to make a Colorful Fan


C/C++ Graphics program to make a Colorful Fan
















#include <graphics.h>
#include <conio.h>

void main()
{

int d,m;
driver = DETECT;
int midx, midy;



initgraph(&d, &m, "d:\\tc\\bgi");

midx = getmaxx() / 2;
midy = getmaxy() / 2;

/* set fill style and draw pie slices */

setfillstyle(1, 2);
pieslice(midx,midy, 180, 210,150);
floodfill(midx,midy,15);

setfillstyle(1, 3);
pieslice(midx,midy, 110, 140,150);
floodfill(midx,midy,15);

setfillstyle(1, 4);
pieslice(midx,midy, 0, 30,150);
floodfill(midx,midy,15);


setfillstyle(1, 1);
pieslice(midx,midy, 80, 50,150);
floodfill(midx,midy,15);


setfillstyle(1, 5);
pieslice(midx,midy, 290, 320,150);
floodfill(midx,midy,15);

setfillstyle(1, 6);
pieslice(midx,midy, 235, 265,150);
floodfill(midx,midy,15);

getch();
closegraph();

}


Output :



















Rotating this fan :

You will learn how to Rotate this fan in the next program.

0 comments:

Post a Comment