Compiler Error "non-lvalue in assignment"

when i compile this code i get "error: non-lvalue in assignment" why? Just so you know, this program soves for the missing parts of a triangle, los and loc are law of sines and law of cosines respectively. The errors are commented and are in the last appx 30 lines of code.

/* Note, a capital letter represents an angle measure and
the same letter lowercase represents the length of the side opposite to that angle */


#include <iostream>
#include <cmath>
#define pi 3.14159265358989

using namespace std;

double A = 0;
double a = 0;
double B = 0;
double b = 0;
double C = 0;
double c = 0;

void degrad();
void raddeg();
void missang();
void los();
void loc();


int main()
{
cout << "Hello, This program will solve a triangle given certain information." << endl;
cout << "Note, It does not have to be a right triangle.";
system("pause");
system("cls");
cout << "Enter any information that you know (Angles in degrees) (If you dont, enter 0)" << endl;

//Enter known parts
cout << "m<A = "; cin >> A;
cout << "a = "; cin >> a;
cout << "m<B = "; cin >> B;
cout << "b = "; cin >> b;
cout << "m<C = "; cin >> C;
cout << "c = "; cin >> c;

missang();
degrad();


los();
loc();

raddeg();

cout << "The Solution of the triangle is:" << endl << endl;
cout << "m<A = " << A << endl;
cout << "a = " << a << endl;
cout << "m<B = " << B << endl;
cout << "b = " << b << endl;
cout << "m<C = " << C << endl;
cout << "c = " << c << endl;


return 0;
}

void degrad()
{
//Converts degrees to radians
A = A * (pi / 180);
B = B * (pi / 180);
C = C * (pi / 180);
}

void raddeg()
{
//Converts radians back to degrees for final answer
A = A * (180 / pi);
B = B * (180 / pi);
C = C * (180 / pi);
}

void los()
//Uses Law of Sines
{
for (int i = 1; i <= 10; i++)
{
//solves for a
if (C != 0 && c != 0 && A != 0)
{
a = (sin(A) * C) / sin(c);
}

//Solves for b
else if (A != 0 && a != 0 && B!= 0)
{
b = (sin(B) * a) / sin(A);
}

//solves for c
else if (B != 0 && b != 0 && C!= 0)
{
C = (sin(C) * b) / sin(B);
}

//Solves for A
else if (C != 0 && c != 0 && a != 0)
{
A = asin((a * sin(B) / b));
}

//Solves for B
else if (A != 0 && a != 0 && b != 0)
{
B = asin((b * sin(A) / a));
}

//Solves for C
else if (B != 0 && b != 0 && c != 0)
{
C = asin((c * sin(B) / b));
}

else if (A != 0 && a != 0 && B != 0 && b != 0 && C != 0 && c != 0)
{
break;
}
}
}

void missang()
//Finds the missing angle if only 2 are entered
{
//Finds A
if (A = 0 && B != 0 && C != 0)
{
A = 180 - C - B;
}

//Finds B
else if (A != 0 && B = 0 && C !=0) //Error is in this line
{
B = 180 - A - C;
}

//Finds C
else if (A != 0 && B != 0 && C = 0) //Same error in this line
{
C = 180 - A - B;
}

}

void loc()
//Uses Law of cosines, not coded yet.
{

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void missang()
//Finds the missing angle if only 2 are entered
{
//Finds A
if (A == 0 && B != 0 && C != 0) // A==, not A=
{
A = 180 - C - B;
}

//Finds B
else if (A != 0 && B == 0 && C !=0) //same for B
{
B = 180 - A - C;
}

//Finds C
else if (A != 0 && B != 0 && C == 0) //and C
{
C = 180 - A - B;
}

}


A single equal to sign (=) is for definition, double (==) is for comparision.
Topic archived. No new replies allowed.