diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 0dd2451..10944bc 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -5,13 +5,23 @@ */ #include <iostream> +#include<math.h> using namespace std; const float temp_min_F = -80, temp_max_F = 121, temp_min_C = -61, temp_max_C = 49.5, wind_min = 0, wind_max = 231; string input = ""; -float temperature = 0, wind_speed = 0; +float temperature = 0, wind_speed = 0, wind_chill = 0;; + +float Temp_Conversion(float temp) { + temp *= 1.8; + temp += 32; + return temp; +} +float Wind_Chill(float temp, float speed) { + return 35.74 + (.6215 * temp) - (35.75 * pow(speed, .16)) + (.4275 * temp * pow(speed, .16)); +} int main() { @@ -60,8 +70,11 @@ int main() } //Convert Celsius to Fahrenheit - if (input == "C") { - temperature *= 1.8; - temperature += 32; - } + if (input == "C") + Temp_Conversion(temperature); + + //Calculate the Wind Chill + wind_chill = Wind_Chill(temperature, wind_speed); + + cout << endl << endl << endl << wind_chill; }
\ No newline at end of file |