I'm trying to make a formula that can identify a right triangle. I'm having some problems with "a" and the = sign.
Error 1: '='; left operand must be l-value.
Error 2: "a". Expression must be a modifiable lvalue.
using namespace std;
cout << "Input value for A." << endl;
cin >> a;
cout << "Input value for B. " << endl;
cin >> b;
cout << "Input value for C. " << endl;
cin >> c;
a ^ 2 + b ^ 2 = c ^ 2;
^ operator is used to get bit-wise XOR in C++.
You should do it in following way:
a ^ 2 + b ^ 2 = c ^ 2 statement, write a block like:
if(pow(c, 2) == pow(a, 2) + pow(b, 2)) std :: cout << "true"; else std :: cout << "false";