@cire how can u have a negative change if t starts at 4 and ends at -12 that is a 16 change and ya I forgot the absolute but 4--12,=16 problem I didn't think was -4-12 =-16 and not 16 but abs should.solve that and you can still use doubles 4.2--10.56= 14.76 change you just have to be careful with the == 0 if itts a double

#include <iostream>
#include <conio.h>
usingnamespace std;
// main part of the program
main()
{
int slope;
int X1;
int Y1;
int X2;
int Y2;
int dy;
int dx;
cout<<"Enter the X-coordinate of the starting point";
cin>>X1;
cout<<"Enter the Y-coordinate of the starting point";
cin>>Y1;
cout<<"Enter the X-coordinate of the ending point";
cin>>X2;
cout<<"Enter the Y-coordinate of the ending point";
cin>>Y2;
//Formula Section
dy = Y2 - Y1;
dx = X2 - X1;
slope = dy/dx;
if (slope == 1)
cout<<"Line will make the 45 degree angle with the horizon"<<endl;
elseif ( resultSlope < 1 )
cout<<"Line will travel more along X-Axis and Less along Y-Axis"<<endl;
elseif ( resultSlope > 1 )
cout<<"Line will travel more along Y-Axis and Less along X-Axis"<<endl;
if (dx == 0)
cout<<" Line is parallel to Y-Axis";
if (dy == 0)
cout<<" Line is parallel to X-Axis";
cout<<"Press any Key to continue...." ;
getch();
}

This program is not complaing Error ... Also check Formulas..

Probably because u have result slope and not dx < dy just fix line 28 30 and u don't need the divide if one is bigger than other it moves more along that axis oh and don't forget the abs of dxand du u can either use the math header abs() or if (dx < 1) dx *= -1 and same for dy

#include <iostream>
#include<conio.h>
usingnamespace std;
main() // main part of the program
{
int slope;
int X1;
int Y1;
int X2;
int Y2;
int dy;
int dx;
cout<<"Enter the X-coordinate of the starting point";
cin>>X1;
cout<<"Enter the Y-coordinate of the starting point";
cin>>Y1;
cout<<"Enter the X-coordinate of the ending point";
cin>>X2;
cout<<"Enter the Y-coordinate of the ending point";
cin>>Y2;
//Formula Section
dy = Y2 - Y1;
dx = X2 - X1;
slope = dy/dx;
if (slope < 1)
cout<<"Line will travel more along X-Axis and Less along Y-Axis";
if (slope == 1)
cout<<"Line will make the 45 degree angle with the horizon";
if (slope > 1)
cout<<"Line will travel more along Y-Axis and Less along X-Axis";
if (dx == 0)
cout<<" Line is parallel to Y-Axis";
if (dy == 0)
cout<<" Line is parallel to X-Axis";
}