Answer to Question #49709 in C++ for nada

Question #49709
Write C++ program that displays the output in a tabular form of temperatures in degree Fahrenheit and degree Celsius for a specified range of values. The program reads the minimum and maximum values for the range of Fahrenheit temperatures and the increment value in Fahrenheit. The program also needs two one-dimensional arrays; one to store the Fahrenheit temperature and the other one to store its corresponding Celsius value. Finally, the program displays on each output line a Fahrenheit temperature and its corresponding Celsius value from these two arrays.
Expert's answer
#include <iostream>
#include <conio.h>
using namespace std;
//function to convert temperature from Celsius to Fahrenheit
int minimumFahrenheitTemperature;
int maximumFahrenheitTemperature;
double Step_FahrenheitTemperature;
double Step_CelsiusTemperature;
double FahrenheitTemperature[20];
double CelsiusTemperature[20];
double TemperatureCelsiusConvertFahrenheit(double c)
return (c*9)/5 + 32;
double TemperatureFahrenheitConvertCelsius(double f)
return (5/9)*(f-32);
int main()
cout << "Input minimumFahrenheitTemperature: ";
cin >> minimumFahrenheitTemperature;
cout << "Input maximumFahrenheitTemperature: ";
cin >> maximumFahrenheitTemperature;
Step_FahrenheitTemperature = (maximumFahrenheitTemperature-minimumFahrenheitTemperature)/20;
for (int i=0;i<=20;i++)
FahrenheitTemperature[i]=minimumFahrenheitTemperature + (i*Step_FahrenheitTemperature);
cout<<FahrenheitTemperature[i]<<" in Fahrenheit"<<" "<<CelsiusTemperature[i]<<" In Celcium "<<endl;
//cout << "Temperature in Fahrenheit is: " << TemperatureCelsiusConvertFahrenheit(celsiusTemp) << " F" << endl; //calculation and output
cout << "Press any key to exit.";
getch(); //waiting for pressing button

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog