Question: #include #include using namespace std; double readFunction(double &fahrenheit, double &endTemp, double &incrementVal) { cin >> fahrenheit >> endTemp >> incrementVal; while(fahrenheit 0) { cout <
#include
double readFunction(double &fahrenheit, double &endTemp, double &incrementVal) { cin >> fahrenheit >> endTemp >> incrementVal; while(fahrenheit <= endTemp || incrementVal > 0) { cout << "Starting tempersture must be <= ending temperature and increment must be > 0.0 "; cin >> fahrenheit >> endTemp >> incrementVal; } }
double convert(double fahrenheit) { double celsius =(fahrenheit -32)/1.8; return celsius; }
double displayFunction(double fahrenheit, double endTemp, double incrementVal) { double celsius = convert(fahrenheit); cout << fixed << setprecision(3); cout << setw(15) << "Fahrenheit " << setw(15) << "Celsius "; cout << setw(15) << fahrenheit << setw(15) << celsius; }
int main() { double fahrenheit, endTemp, incrementVal;
readFunction(fahrenheit, endTemp, incrementVal);
double celsius = convert(fahrenheit); convert(fahrenheit); displayFunction(fahrenheit, endTemp, incrementVal);
return 0; }
*************************** Teres our the outputs -30 100 20
The output would be:
Fahrenheit Celsius -30.000 -34.444 -10.000 -23.333 10.000 -12.222 30.000 -1.111 50.000 10.000 70.000 21.111 90.000 32.222
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
40 30 5 30 40 -5 30 40 5
We get the output:
Starting temperature must be <= ending temperature and increment must be > 0.0 Starting temperature must be <= ending temperature and increment must be > 0.0 Fahrenheit Celsius 30.000 -1.111 35.000 1.667 40.000 4.444
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
100.5 110.4 5
The valid output will be:
Fahrenheit Celsius 100.500 38.056 105.500 40.833
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
