Fan

Description:           This program creates a graphic for fan motion.

 
Primary Inputs:    —–
Primary Output:    fan in motion
Platform Used:      Turbo C++ version 3.0, Borland International Inc.
 

#include
#include
#include
#include #include

void main()
{
int gdriver=DETECT;
int gmode;
float x,y,u,g,h,x1,y1,x2,y2,r,r1,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8,x9,y9;
initgraph(&gdriver, &gmode,"c:\\tc\\bgi");
x=getmaxx()/2;
y=getmaxy()/2;
r=20;
r1=200;

for(h=0;h<=360;h++) { clearviewport(); circle(x,y,r); x1=x+r*cos(h*3.14/180); y1=y+r*sin(h*3.14/180); x2=x+r1*cos(h*3.14/180); y2=y+r1*sin(h*3.14/180); x3=x+r1*cos((h+15)*3.14/180); y3=y+r1*sin((h+15)*3.14/180); line(x1,y1,x2,y2); line(x1,y1,x3,y3); line(x2,y2,x3,y3); x4=x+r*cos((h+120)*3.14/180); y4=y+r*sin((h+120)*3.14/180); x5=x+r1*cos((h+120)*3.14/180); y5=y+r1*sin((h+120)*3.14/180); x6=x+r1*cos((h+135)*3.14/180); y6=y+r1*sin((h+135)*3.14/180); line(x4,y4,x5,y5); line(x4,y4,x6,y6); line(x5,y5,x6,y6); x7=x+r*cos((h+240)*3.14/180); y7=y+r*sin((h+240)*3.14/180); x8=x+r1*cos((h+240)*3.14/180); y8=y+r1*sin((h+240)*3.14/180); x9=x+r1*cos((h+255)*3.14/180); y9=y+r1*sin((h+255)*3.14/180); line(x7,y7,x8,y8); line(x7,y7,x9,y9); line(x8,y8,x9,y9); } getch(); closegraph(); }

 

1/5 - (3 votes)

Leave a Reply