#include"stdio.h"
#include"graphics.h"
#include"conio.h"
#include"math.h"
#define PI 3.14
void main()
{
int h,k;
float r,x,y,t,t1,t2;
int i=DETECT,M,g;
clrscr();
initgraph(&i,&M," ");
printf("Enter the values of h,k,r,t1,t2:");
scanf("%d%d%f%f%f",&h,&k,&r,&t1,&t2);
for(t=t1;t<=t2;t++)
{ delay(100);
x=r*cos((PI/180)*t);
y=r*sin((PI/180)*t);
if(t1>=0&&t2<=45)
putpixel(h+x,y+k,1);
else if(t1>45&&t2<=90)
putpixel(h+x,-y+k,2);
else if(t1>90&&t2<=135)
putpixel(-y+h,x+k,3);
else if(t1>135&&t2<=180)
putpixel(-y+h,-x+k,4);
else if(t1>180&&t2<=225)
putpixel(-x+h,-y+k,5);
else if(t1>225&&t2<=270)
putpixel(-x+h,y+k,6);
else if(t1>270&&t2<=315)
putpixel(y+h,-x+k,7);
else
putpixel(y+h,x+k,8);
}
line(h,k,r*cos((PI/180)*t1)+h,r*sin((PI/180)*t1)+k);
line(h,k,r*cos((PI/180)*t2)+h,r*sin((PI/180)*t2)+k);
getch();
}
Tuesday, 6 January 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment