Program:
#include<stdio.h>
#include<graphics.h>
#include<math.h>
int gd,gm;
int main()
{
float PI=3.14;
int r,i,a,b,x,y;
initgraph(&gd,&gm,"C:\TURBOC3\BGI");
detectgraph(&gd,&gm);
setcolor(RED);
//draw the top rectangle and color it
floodfill(101,101,RED);
rectangle(100,100,450,150);
setfillstyle(SOLID_FILL,RED);
rectangle(100,150,450,200);
//draw the middle rectangle and color it
setcolor(WHITE);
rectangle(100,200,450,250);
setfillstyle(SOLID_FILL,WHITE);
floodfill(101,151,WHITE);
//draw the bottom rectangle and color it
setcolor(GREEN);
r=25; //radius
setfillstyle(SOLID_FILL,GREEN);
floodfill(101,201,GREEN);
a=275; //center
//draw the circle
b=175; //center
line(a,b,a+x,b-y);
setcolor(BLUE);
circle(a,b,r);
for(i=0;i<=360;i=i+15)
//spokes
{
y=rsin(iPI/180);
x=rcos(iPI/180);
}
}
getch();
closegraph();
return 0;
}
Output:
Comments