During winter when it is very cold, everyone would like to know the windchill fa
ID: 3647495 • Letter: D
Question
During winter when it is very cold, everyone would like to know the windchill factor is computed using the following formula: W = 35. 74 + 0. 6125 * T - 35. 375 * V0. 16 + . 4275 * T * V0. 16 Where V is the wind speed in MPH, T is Temperature in degrees Fahrenheit. Write a program to input wind speed, temperature in degrees Fahrenheit. The program then displays windchill factor. The program must contain at least two functions: one to get the user input and the other to determine the windchill factor and Inside main, the program should run a loop three times by calling the two functions.Explanation / Answer
please rate - thanks
#include <iostream>
#include <cmath>
using namespace std;
void Input(double&,double&);
double windchill(double,double);
int main()
{double wind,temp,windc;
int i;
for(i=0;i<3;i++)
{Input(wind,temp);
windc=windchill(wind,temp);
cout<<" case "<<i+1<<endl;
cout<<"Temperature: "<<temp<<endl;
cout<<"Wind speed: "<<wind<<endl;
cout<<"Windchill factor: "<<windc<<endl<<endl;
}
system("pause");
return 0;
}
void Input(double& w,double& t)
{cout<<"enter the wind speed: ";
cin>>w;
cout<<"Enter the temperature: ";
cin>>t;
}
double windchill(double w,double t)
{
return 35.74+.6125*t-35.375*pow(w,.16)+.4275*t*pow(w,.16);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.