Not sure what I am doing wrong here

#include <iostream>
using namespace std;

void checkLines(double slope1, double slope2)
{
if (slope1 = slope2)
{
cout << "\n Your slopes are parallel." << endl;
}
if (slope1*slope2 = -1)
{
cout << "Your slopes are perpendicular." << endl;
}
else
cout << "Your slopes are regularly intersected." << endl;
}
int main()
{
double slope1, slope2;
cout << "\n Please input two slopes of two different lines."<<endl;
cin >> slope1;
cin >> slope2;
checkLines(slope1,slope2);

}
any help is appreciated
Equality check is ==, assignment is =.
Please use code brackes
Fixed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;
double slope1, slope2, slopemul;
void checkLines()
{
if (slope1 == slope2)
{
cout << "\n Your slopes are parallel." << endl;
}
slopemul=slope1*slope2;
if (slopemul==-1)
{
cout << "Your slopes are perpendicular." << endl;
}
else
cout << "Your slopes are regularly intersected." << endl;
}
int main()
{
cout << "\n Please input two slopes of two different lines."<<endl;
cin >> slope1;
cin >> slope2;
checkLines();
}
Topic archived. No new replies allowed.