summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Rogers <[email protected]>2022-11-07 23:27:41 -0800
committerTaylor Rogers <[email protected]>2022-11-07 23:27:41 -0800
commit004718e7a60135b5e5e677f8c7067f1af9e88506 (patch)
treefa9715799b0e7b538e1b811eda92436c24b96804
parentFinished the basic inputs (diff)
downloadcst116-lab2-taylorrog-004718e7a60135b5e5e677f8c7067f1af9e88506.tar.xz
cst116-lab2-taylorrog-004718e7a60135b5e5e677f8c7067f1af9e88506.zip
Got all the functions sorta working
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 734c153..957cc05 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -61,8 +61,29 @@ float Wchill{};
float FtoCfunc(float FtoCval)
{
FtoCval = 0;
- FtoCval = (TvalF - 32) * (5 / 9);
- return FtoCval;
+ FtoCval = (TvalF - 32) * (5.0f / 9.0f);
+ TvalC = FtoCval;
+ return TvalC;
+}
+
+
+// Converts Celsius to Fahrenheit
+float CtoFfunc(float CtoFval)
+{
+ CtoFval = 0;
+ CtoFval = (9.0f / 5.0f) * TvalC + 32;
+ TvalF = CtoFval;
+ return TvalF;
+}
+
+
+// Converts Windspeed and Temp to Winchill
+float Wchfunc(float Wchcalc)
+{
+ Wchcalc = 0;
+ Wchcalc = 35.74f + .6215f * TvalF - 35.75f * (pow(Wspeed, 0.16f)) + 0.4275f * TvalF * (pow(Wspeed, 0.16f));
+ Wchill = Wchcalc;
+ return (Wchill);
}
int main()
@@ -103,6 +124,7 @@ int main()
cin >> TvalF;
}
}
+ FtoCfunc(TvalC);
}
// Temp input in C
@@ -133,6 +155,7 @@ int main()
cin >> TvalC;
}
}
+ CtoFfunc(TvalF);
}
else
@@ -167,35 +190,14 @@ int main()
}
}
+ Wchfunc(Wchill);
+
cout << endl;
cout << setw(20) << "Temp in C" << setw(20) << "Temp in F" << setw(20) << "Wind Speed" << setw(20) << "Wind Chill" << endl;
cout << setw(20) << TvalC << setw(20) << TvalF << setw(20) << Wspeed << setw(20) << Wchill << endl;
- cout << FtoCfunc;
-
cout << endl;
-}
-
-
-
-
-
-
-
-// Converts Celsius to Fahrenheit
-void CtoFfunc(float CtoFval)
-{
- CtoFval = (9 / 5) * TvalC + 32;
- //TvalF = CtoFval;
- //cout << TvalF;
-}
-
-// Converts Windspeed and Temp to Winchill
-void Wchfunc(float Wchill)
-{
- Wchill = 35.74 + .6215 * TvalF - 35.75 * (pow(Wspeed, 0.16)) + 0.4275 * TvalF * (pow(Wspeed, 0.16));
- //cout << Wchill;
} \ No newline at end of file