Program:
#include <math.h>
#include<stdio.h>
#include <conio.h>
#include <graphics.h>
void main()
{
int gd=DETECT,gm,x1,x2,y1,y2,x4,y4;
float angle=0.0,ang;
initgraph(&gd,&gm,"C:\\turboc3\\BGI");
printf("Enter Co-ordinates:");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
line(x1,y1,x2,y2);
printf("Enter the angle:");
scanf("%f",&ang);
angle=(ang*3.14)/180;
x4=x2-(((x2-x1)*cos(angle))-((y2-y1)*sin(angle)));
y4=y2-(((x2-x1)*sin(angle))+((y2-y1)*cos(angle)));
line(x2,y2,x4,y4);
getch();
closegraph();
}
#include <math.h>
#include<stdio.h>
#include <conio.h>
#include <graphics.h>
void main()
{
int gd=DETECT,gm,x1,x2,y1,y2,x4,y4;
float angle=0.0,ang;
initgraph(&gd,&gm,"C:\\turboc3\\BGI");
printf("Enter Co-ordinates:");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
line(x1,y1,x2,y2);
printf("Enter the angle:");
scanf("%f",&ang);
angle=(ang*3.14)/180;
x4=x2-(((x2-x1)*cos(angle))-((y2-y1)*sin(angle)));
y4=y2-(((x2-x1)*sin(angle))+((y2-y1)*cos(angle)));
line(x2,y2,x4,y4);
getch();
closegraph();
}
Comments
Post a Comment
Thank you