Output revised help

Hi everyone,

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.




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,

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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");
}

Why are you starting a second thread for the same problem you posted here?
http://www.cplusplus.com/forum/beginner/201033/
DamianH

I think you will need to include two extra headers to make this compile for a strict compiler:
cstdlib (for system()) and cmath (for pow()).

It isn't critical but:
- you are putting essentially the same temperature in twice - you don't need this.
- consider using a reference parameter (use &) in the definition of input1 - it will save having to use all those pointer symbols; see:
http://www.cplusplus.com/doc/tutorial/functions/
- for tidiness' sake get line 57 to output a new line at the end.

You can check your final calculation using
https://www.weather.gov/epz/wxcalc_windchill
There doesn't seem to be much physics in that formula, anyway.

lastchance


I do agree it is basically putting the same temperature twice but that's how the output is wanted.
Topic archived. No new replies allowed.