FLYING KITE SIMULATION
This is a program that depicts the working of a flying kite.It uses built in library functions of garphics.h header file.
Implementation in C
#include<stdio.h> #include<stdlib.h> #include<conio.h> #include<dos.h> #include<graphics.h> #include<ctype.h> #include<math.h> void main() { int gd=DETECT,gm; int color; int x=10,y=1,xincr=10,yincr=10; int polygon[10]; initgraph(&gd,&gm," "); while(!kbhit()) { x += xincr; if(x > 200) xincr = -5; if(x < 0 ) xincr = 10; y += yincr; if(y > 100) yincr = -10; if(y < 0 ) yincr = 10; cleardevice(); setcolor(WHITE); setbkcolor(BLUE); polygon[0]=100+x; polygon[1]=50+y; polygon[2]=140+x; polygon[3]=100+y; polygon[4]=100+x; polygon[5]=155+y; polygon[6]=60+x; polygon[7]=100+y; polygon[8]=100+x; polygon[9]=50+y; drawpolygon(5,polygon); setfillstyle(SOLID_FILL,RED); fillpolygon(5,polygon); setlinestyle(SOLID_LINE,1,3); line(100+x,155+y,100+x,180+y); line(100+x,155+y,110+x,180+y); line(100+x,155+y,90+x,180+y); setlinestyle(SOLID_LINE,1,0); line(0,480,100+x,90+y); line(100+x,90+y,130+x,100+y); line(100+x,90+y,70+x,100+y); line(100+x,90+y,100+x,70+y); delay(260); } setlinestyle(SOLID_LINE,0,0); fflush(stdin); }