Pages: 1234
@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
 ``1234567891011121314151617181920212223242526272829303132333435363738`` ``````#include #include using namespace 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"< 1 ) cout<<"Line will travel more along Y-Axis and Less along X-Axis"<

`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
Last edited on
@giblit ` iostream: No such file or directory. `
Error is in `#include <iostream> `
Try a c++ compiler
@ne555 I am using C++ compiler
You have a major flaw in your design then if you're getting that error
the major flaw is ? if u can mention the flaw. Please @giblit
Then how are you getting that error ? Which ide are you using and maybe post full code
I don't know how i have the errors :(
> I am using C++ compiler
¿which one? It may be previous to 1998 if it doesn't have `iostream'

Try gcc 4.8
Last edited on
Which ide? And you have the #include <iosream> at the top out of your function
 ``123456789101112131415161718192021222324252627282930313233343536`` ``````#include #include using namespace 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"; }``````

Look at this program :(
Last edited on
Well it should compile except you still hacent listened about dividing and the abs
But not compiling :( But y not compiling the Program ;;;
Like ne55 said probably pre 98 cmpiler try a different one or a newer ide wiith a newer compiler
I haven't any more copiler :(