# Question: 14.6 Lab 2b – Base/Hypotenuse Angle For this lab (1) Read in the width and height of a right triangle (2) Print out the Hypotenuse to two decimal places (3) Calculate the angle between the base and hypotenuse (4) Print the angle in radians to two decimal places NOTE End each value with a new line – Free Chegg Question Answer

in C++ ssof code and output plz

Transcribed text From Image:14.6 Lab 2b - Base/Hypotenuse Angle For this lab (1) Read in the width and height of a right triangle (2) Print out the Hypotenuse to two decimal places (3) Calculate the angle between the base and hypotenuse (4) Print the angle in radians to two decimal places NOTE End each value with a new line

## Expert Chegg Question Answer:

Answer:

## Answer

**main.cpp:**

#include <iostream>

#include <cstdlib>

#include <string>

#include <iomanip>

#include <cmath>

#define PI 3.1415926535

using namespace std;

int main()

{

float a, b; // the smaller two sides of the triangle

float hyp; // the hypotenuse calculated by the program

cout << “Please input the value of the width and height “;

cin >> a >> b;

// Fill in the assignment statement that determines the hypotenuse

hyp = sqrt(pow(a, 2) + pow(b, 2));

// Fill in a statement that will output decimal numbers to 5 decimal places

cout << fixed << setprecision(2);

cout << “The sides of the right triangle are ” << a << ” and ” << b << endl;

cout << “The hypotenuse is ” << hyp << endl;

//height between base and hypotenuse

// applied cosine rule

double A = acos((a * a + hyp * hyp – b * b) / (2 * a * hyp));

// convert into degrees and return

A = A * 180 / PI;

cout << “The angle between base and hypotenuse is “<< A << endl;

//height between height and hypotenuse (optional)

// applied cosine rule

double B = acos((b * b + hyp * hyp – a * a) / (2 * b * hyp));

// convert into degrees

B = B * 180 / PI;

cout << “The angle between base and hypotenuse is “<< B << endl;

}

**Output:**