using namespace std;
cout << "Please type in the temperature in degrees Celsius.\n";
cin >> temperature;
if (temperature > 10)
cout << "The value you entered violates the temperature restriction.\n";
cout << "Please type in the wind speed in meters per second.\n";
cin >> windSpeed;
cout << "The wind chill index is " << 33 - (((10 * sqrt(windSpeed) - windSpeed + 10.5) * (33 - temperature)) / 23.1) << " degrees Celsius.\n";
The problem I'm having is this. Let us say that I plug in a number such as 9 or 10 for windSpeed and temperature. The program works fine. Now instead, if I plug in 20 in for one of the values, the output gets way off. What is going on with my code? Any help would be greatly appreciated!
Well, the program won't let you input anything greater then 10 when asking for the temperture. Have you tried just doing the math on a piece of paper to see if it's correct? I can't imagine why the calculation would result in a different result because you used a different wind speed.