Answer to Question #49779 in C++ for Saad Abdollah Motamed

Question #49779
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.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 o
1
Expert's answer
2014-12-16T05:23:51-0500
#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);
CelsiusTemperature[i]=5*(FahrenheitTemperature[i]-32)/9;
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS