Question: Write a program that allows the user to enter the user to enter two sides of a triangle, a and b and the measure of

Write a program that allows the user to enter the user to enter two sides of a triangle, a and b and the measure of non-included angle A (in degrees) and prints out the measures of the other two angles (if possible).

Note that there are three possible cases - no solution, one solution, or two solutions (in which case you should print both possible pairs of angles). Look for the section called Case 2: SSA or The Ambiguous Case on this web page it shows how to identify how many answers there are:

This is the code I have so far but for some reason, it's giving me errors and I can't seem to figure it out.

I also don't need sideC at all so if I could get that removed without tarnishing the code that would help.

#include #include using namespace std; const double (Pi) = 3.14159653589793; double degrees (double input); { input = input * (180 / Pi); return (input); } double radians (double input); { input = input * (Pi / 180); return (input); } double convert (double input); { double pi = 3.14159653589793; return(radian * (180 / pi)); } int main() { double a, b, degA; double radA, radB, radC; int sideB, cin >> a ; cout << "enter a: "; cin >> b ; cout << "enter b: "; cout << "enter A: "; radA = radians(degA); if(degA > 90){ sideB = degrees(asin(b * sin(radA) / a)); sideC = 180 - (degA + sideB); cout << "angle b = " << sideB << " degrees "; cout << "angle c = " << sideC << " degrees "; } else { if(a < b && a > b * sin(radA)){ sideB = degrees(asin(b * sin(radA) / a)); sideC = 180 - (degA + sideB); cout << "angle b = " << sideB << " degrees "; cout << "angle c = " << sideC << " degrees "; cout << "or "; sideB = 180 - sideB; cout << "angle b = " << sideB << " degrees "; cout << "angle c = " << sideC << " degrees "; } else{ cout<<"no solution"; } } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!