Hello everyone first time posting here, I have spent hours trying to figure out how to write this program that our instructor has given to us as an assignment. http://en.m.wikipedia.org/wiki/Bogosort#section_3Instructions are bellow
Frequently, the temperatures on the news are given in Centigrade rather than Fahrenheit. The formula for conversion is
C = 5 / 9 * F - 32
My friend does it another way; he says that a good approximation when converting Fahrenheit to centigrade is to take half the Fahrenheit temperature and subtract 15. How good an approximation is it?
Write a program that takes the following three temperatures in Fahrenheit:
38 -45.38 89.3495
and for each, outputs
the correct temperature in Centigrade the approximated temperature in Centigrade the percentage error in the approximation
see this link for a description of percentage error: http://wiki.answers.com/Q/What_is_the_percent_error_formula
We will not be doing input in this program. Instead, code the initial three temperature into your program as constants, i.e. your program should begin with
int main const float temp1 = 38; const float temp2 = -45.38; const float temp3 = 89.3495;
Your output should be in tabular form, with headings, column aligned, right justified, with each temperature printed in fixed format with two decimal places accuracy. The percentage error should be to the nearest tenth of a percent and always positive, (use <cmath> library function called fabs absolute value).
Your output should look exactly like this:
Edited 4 Years Ago by pyTony: format made readable