From 281a67cb3d46a64a79f624a860561e68273b53c5 Mon Sep 17 00:00:00 2001 From: "smithbenjamin2022@gmail.com" Date: Wed, 9 Nov 2022 15:12:36 -0800 Subject: FUNCTIONS --- BlankConsoleLab/BlankConsoleLab.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'BlankConsoleLab/BlankConsoleLab.cpp') 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 +#include 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 -- cgit v1.2.3