I need help
Write a C++ program which reads in Fahrenheit temperatures (type float) from the keyboard and converts them to their Centigrade equivalents; recall the rule Centigrade - (5.0/9.0) * (Fahrenheit - 32) for converting Fahrenheit to centigrade. Your program should output both the inputted Fahrenheit temperatures and their Centigrade equivalents in tabular form. (See below.) When the input has been exhausted, your program should also output the average of the temperatures processed, in both Fahrenheit and Centigrade. (See the illustration below.) your program should contain a \"read loop\" for reading in one temperature at a the, converting that temperature, outputting both the inputted temperature and its Centigrade equivalent, and doing whatever bookkeeping is needed for the \"average\" computation before looping back to input the next temperature. Your program should be able to handle an arbitrary number of input temperatures. (The illustration below shows an input of seven temperatures.) Illustration: Given the inputs 86.0, 91.0, 87.4, 100.3, rightarrow 8.6, 77.0, and 83.7, your program should output the following table: As usual, please hand in a paper copy of your C++ source code and a paper copy of your output. Feel free to test your program on any input of your choosing, but, to help me in grading your work, please hand in only the output your program produces on the above Input.
#include <iostream>
#include <iomanip>
#include <math.h>
using std::cout;
using std::cin;
using std::setw;
int main()
{
float f[5];
int x;
Float af=0.0;
Float ac=0.0;
float c[5];
for(x=0;x<=4;x++)
{
cout<<\"enter a value in Fahrenheit: \";
cin>>f [x];
c [x]=(5.0/9.0)*(f [x]-32);
af= af+ f[x];
ac=ac+c[x];
}
cout << \"\ # Fahrenheit Celsius \ \";
// output loop
for ( int i = 0; i < 4; ) {
cout << setw(10) << ++i << std::fixed << std::setprecision(2)
<< setw(10) << f [i]
<< setw(10) << c[i] << std::endl;
}
cout << “Average “<< af<< ac;
}
| float f[5]; int x; |
| Float af=0.0; Float ac=0.0; |