#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
void main()
{
int gdriver=DETECT,gmode;
double midx=350,midy=300;
double x1,y1,x2,y2,x22,y22;
int x,y,i,j=0;
double theta=0,t;
clrscr();
initgraph(&gdriver,&gmode,"c:/tc/bgi");
printf("\n Enter the 1st co-ordinate=");
scanf("%lf%lf",&x1,&y1);
printf("\n Enter the 2nd co-ordinate=");
scanf("%lf%lf",&x2,&y2);
clrscr();
line(midx,midy-150,midx,midy+150);
line(midx+150,midy,midx-150,midy);
setcolor(2);
outtextxy(midx,midy," origin");
line(midx+x1,midy+y1,midx+x2,midy+y2);
//getch();
for(i=theta;i<=900;i++)
{
t=i*0.01744;
x22=x2*cos(t)-y2*sin(t);
y22=x2*sin(t)+y2*cos(t);
line(midx+x1,midy+y1,midx+x22,midy+y22);
setcolor(j);
j=j+1;
delay(20);
if(i==900)
exit(1);
}
getch();
}
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
void main()
{
int gdriver=DETECT,gmode;
double midx=350,midy=300;
double x1,y1,x2,y2,x22,y22;
int x,y,i,j=0;
double theta=0,t;
clrscr();
initgraph(&gdriver,&gmode,"c:/tc/bgi");
printf("\n Enter the 1st co-ordinate=");
scanf("%lf%lf",&x1,&y1);
printf("\n Enter the 2nd co-ordinate=");
scanf("%lf%lf",&x2,&y2);
clrscr();
line(midx,midy-150,midx,midy+150);
line(midx+150,midy,midx-150,midy);
setcolor(2);
outtextxy(midx,midy," origin");
line(midx+x1,midy+y1,midx+x2,midy+y2);
//getch();
for(i=theta;i<=900;i++)
{
t=i*0.01744;
x22=x2*cos(t)-y2*sin(t);
y22=x2*sin(t)+y2*cos(t);
line(midx+x1,midy+y1,midx+x22,midy+y22);
setcolor(j);
j=j+1;
delay(20);
if(i==900)
exit(1);
}
getch();
}
No comments:
Post a Comment