float calculateSideC(float sideA, float sideB, float angleC)
{
constfloat CONVERSION_VALUE = 3.14159 / 180.0;
float radians;
float sideC;
// Convert the value of angle C to its value in radians using the CONVERSION_VALUE
radians = (angleC * CONVERSION_VALUE);
// Calculate the value of side C using the cosine law. To square a
// number, simply multiply the two numbers together rather than call the
// pow() function (e.g., sideA * sideA). Be sure to use the sqrt()
// function on the math expression before assigning the result to sideC
sideC = sqrt(sideC);
sideC = sideA * sideA + sideB * sideB - (2 * sideA * sideB * cos (radians));
// Return the value of side C
return sideC;
} // End calculateSideC
should either be swapped or simply sqrt before assigning like assignment says so sideC = sqrt(sideA * sideA + sideB * sideB - (2 * sideA * sideB * cos (radians)));
void processRowOfData(void)
{
float sideA;
float sideB;
float angleC;
float sideC;
// Prompt the user to enter values for side A, side B, and angle C
cout << "Enter the values of side A, side B, and angle C (in degrees)." << endl;
cout << "Separate each value by one or more spaces:" << endl;
// Read in the three values
cin >> sideA >> sideB >> angleC;
// Call the calculateSideC function, pass the appropriate values to it,
// and store the returned value
calculateSideC (sideA, sideB, angleC);
// Call the printResults function and pass it the appropriate values
printResults (sideA, sideB, angleC, sideC);
}