Formulas Erroe here please Correct.

I don't think here is any Formulas error but here it is.
So please correct the Error int this Program.
Problem is in this lines [cout<< "Line wil travel more along X-axis & less along Y-axis";
if (resultSlope>1);
cout<< "Line wil travel more along Y-axis & less along X-axis";
{
cout<<"Press any Key to continue....";]

#include <iostream>
#include <conio.h>
using namespace std;
// Main Function
int main()
{
int y1,y2,x1,x2;

double resultSlope;
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;
resultSlope =(y2-y1)/(x2-x1);
if (resultSlope<1);
cout<< "Line wil travel more along X-axis & less along Y-axis";
if (resultSlope>1);
cout<< "Line wil travel more along Y-axis & less along X-axis";
{
cout<<"Press any Key to continue....";
getch();
}
}
Last edited on
remove the semi-colons from the if statements

if (resultSlope>1)
cout<< "Line wil travel more along Y-axis & less along X-axis";
this line is not working
Last edited on
Well put a:

 
<< endl;


At the point where you want an carriage return
I have the problem again the formula is not working?/
cout<< "Line wil travel more along Y-axis & less along X-axis";
{
cout<<"Press any Key to continue....";
getch ():
}
}


these line are print in One line I want print these two in different line please help me
as suggested by ajh32,

cout<< "Line wil travel more along Y-axis & less along X-axis" << endl;
Thanks to All
Topic archived. No new replies allowed.