Assignment

Write a program that, given three adjacent measurement s of a triangle, calculates the remaining three.

Program Description

Inputs:

For this program, you will be given three measurements of a triangle: side-angle-side, angle-side-angle, side-side-side, etc. The input stream will consist of sets of data that both identify what is being given and the actual measurements in the following form:

(type, meas1, meas2, meas3)

type may be:

ASA angle, side, angle

SAS side, angle, side

SSS side, side, side

AAS angle, angle, opposite side

meas1, meas2 and meas3 are:

double precision floating point numbers for the measurements.

All angles are in degrees, not radians.

Outputs:

You must calculate the remaining 3 measurements (sides and/or angles) using the rules learned in geometry. (Get out your geometry text if you don’t remember.

Construction detail 1:

Build a structure typedef to contain the 3 sides and 3 angles for a triangle.

Construction detail 2:

Build a separate function for each solution case.

Construction detail 3:

Build a header file to contain the typedef for the structure and the prototypes for each of the functions. Include this header file in you main program, which must be in a separate file named “ triangles.h”

Construction detail 4:

Write a main program that:

1. inputs the description of the triangle,

2. echoes the triangle’s description

3. uses the individual functions to calculate the missing information,

4. then prints the completed triangle.

Remember that the main program must include the “triangles.h” header file, and may not be the same file as the functions.