Output Help/code included

Hi Everyone could anybody help me on why my wind chill factor does not equal -20



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.
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
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;
// These are all the declarations used to calculate the windchill as well as what is used to store the 
// users input
int windchill(double wind, double temp);
double w;
int windchill(double v, double t);
double wind, temp;

int main()
{
	
	double wind, temp;
	cout << "Enter the wind speed in miles per hour: ";
	cin >> wind;
	cout << "Enter the temperature in fahrenheit: ";
	cin >> temp;
	cout << "Current temperature: " << temp << "F" << endl;
	cout << "Windchill factor " << setprecision(4) << fixed << windchill(wind, temp) << endl;
	system("pause");

}
// This is the part of the program that calculates the windchill factor and the output is shown 
//above to the user. 
int windchill(double v, double t)
{
	double w;
	w = 33 - (((10 * sqrt(v) - v + 10.5)*(33 - t)) / 23.1);
	return w;

	return 0;
	system("pause");
}
Line 9: This global is never used. Get rid of it. Globals should be avoided.

Line 11: These variables are hidden by the declarations at line 16. Why are they here?

Line 31: This formula looks nothing like the formula given in your problem description.

Lines 34-35: These lines will never be reached.

Line 24: main should return 0.
Revised


Can someone help me on the output the output is suppose to be -20. I also want the current temperature to stay 11. I am stuck in this two parts.








#include<iostream>

using namespace std;

void input1(double *speed, double *temp)

{



cout << endl << "Enter the wind speed in miles per hour : ";

cin >> *speed;

cout << endl << "Enter temperature in fahrenheit: ";

cin >> *temp;

cout << endl << "Current temperature: ";
cin >> *temp;

}



double chillfactor(double V, double T)

{



double factor;

factor = (35.74 + 0.6215 * T - 35.75*pow(V, 0.16) + 0.4275*T*pow(V, 0.16));


return factor;

}



int main()

{



double speed, temp;

input1(&speed, &temp);

double factor;

factor = chillfactor(speed, temp);

cout << endl << "the chillfactor is " << factor;
system("pause");
}
Topic archived. No new replies allowed.