Newbie code included need help

Hi Everyone this is what I have so far but below is how the output is supposed to have -20 and an extra current temperature what am i doing wrong?




During winter when it is very cold, typically, everyone would like to know the windchill factor, especially, before going out. Meteorologists use the following formula to compute the windchill factor, W:

W = 35.74 + 0.6215 * T-35.75*V0.16 + 0.4275 * T *V0.16,

where V is the wind speed in miles per hour and T is the temperature in degrees Fahrenheit.

Write a program that prompts the user to input the wind speed, in miles per hour, and the temperature in degrees Fahrenheit. The program then outputs the windchill factor.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

//windchill funciton which calculates the factor
double windchill(double wind,double temp)
{
    return 35.74 + 0.6215 * temp - 35.75 * pow(wind, 0.16) + 0.4275 * temp * pow(wind,0.16);
}
//prompts the user for values and passes it to other funciton
void read()
{
    double wind, temp;
    cout << "Enter the wind speed in miles per hour: ";
    cin >> wind;
    cout << "Enter the temperature in fahrenheit: ";
    cin >> temp;
    cout << "Windchill factor " << setprecision(4) << fixed << windchill(wind, temp) << endl;
}

int main()
{
    read();
   return 0;
}
What is the problem? The code looks like it should work. I don't understand what the problem you are having is. Please explain more.
Last edited on
Topic archived. No new replies allowed.