Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Describe various competitive compensation policies.

Answered: 1 week ago