diff options
| author | [email protected] <[email protected]> | 2022-11-09 15:12:36 -0800 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2022-11-09 15:12:36 -0800 |
| commit | 281a67cb3d46a64a79f624a860561e68273b53c5 (patch) | |
| tree | 7c4edb49d8b016c20d8f46d89afaf40171ae9225 | |
| parent | Errors fixed and formatting slightly improved (diff) | |
| download | cst116-lab2-smith-benjamin-281a67cb3d46a64a79f624a860561e68273b53c5.tar.xz cst116-lab2-smith-benjamin-281a67cb3d46a64a79f624a860561e68273b53c5.zip | |
FUNCTIONS
| -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 |