#include <iostream.h>
main()
{
// Declaring variables for input (x,y) and (x1,y1)
int a,b,c,d;
// Declaring variables for formula dx(x1 - x) and dy(y1 - y)
float m,x,y;
cout "Enter the X - Coordinate of the Starting point = ";
cin>> a;
cout "Enter the Y - Coordinate of the Starting point = ";
cin>> b;
cout "Enter the X - Coordinate of the Ending point = ";
cin>> c;
cout "Enter the Y - Coordinate of the Ending point = ";
cin>> d ;
// acording to formula dx(x1 - x)
x = c-a ;
// show message if the resualt (x1 - x)= 0
if (x==0)
{ cout "Line is parallel to Y - Axis ";
}
else
{
// show message if the resualt (y1 - y)= 0
y = d-b ;
if (y==0)
{ cout "Line is parallel to X - Axis ";
}
else
{
// show message if the resualt (dy/dx )= 1
m = y/x;
if (m==1)
{
cout "Line will make the 45 degree angle with the Horizon ";
}
else
{
// show message if the resualt dy/dx > 1
if (m>1)
{
cout "Line will travel more along Y- Axis And less along X- Axis" ;
}
// show message if the resualt dy/dx < 1
if (m<1)
{
cout "Line will travel more along X- Axis And less along Y- Axis" ;
}
}
}
}
}
0 comments
Post a Comment