summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Rogers <[email protected]>2022-11-07 21:14:13 -0800
committerTaylor Rogers <[email protected]>2022-11-07 21:14:13 -0800
commit8be5a29ec5bf75883ee70fe9eee27b6b823757e0 (patch)
tree6f5fec72806ddc1078a409b2f7206952e6409482
parentAdded more to main and final function (diff)
downloadcst116-lab2-taylorrog-8be5a29ec5bf75883ee70fe9eee27b6b823757e0.tar.xz
cst116-lab2-taylorrog-8be5a29ec5bf75883ee70fe9eee27b6b823757e0.zip
Struggling
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp51
1 files changed, 28 insertions, 23 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index b0c3124..59e71cf 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -41,11 +41,6 @@ using std::cout;
using std::cin;
using std::endl;
-char Tunit = 0;
-signed int TvalF = 0;
-signed int TvalC = 0;
-int Wspeed = 0;
-
const int Fmax = 121;
signed const int Fmin = -80;
const int Cmax = 49.5;
@@ -53,11 +48,19 @@ signed const int Cmin = -62;
const int Wmax = 231;
const int Wmin = 0;
-void FtoCfunc(signed int FtoCval);
-
-void CtoFfunc(signed int CtoFval);
+char Tunit{};
+float TvalF{};
+float TvalC{};
+int Wspeed{};
+float Wchill{};
-void Wchfunc(signed int Wchill);
+// Converts Fahrenheit to Celsius
+float FtoCfunc(float FtoCval)
+{
+ FtoCval = 0;
+ FtoCval = (TvalF - 32) * (5 / 9);
+ return FtoCval;
+}
int main()
{
@@ -68,40 +71,42 @@ int main()
cout << "Please enter temperature: ";
if (Tunit == 70)
+ {
cin >> TvalF;
+ }
+
+
else if (Tunit == 67)
cin >> TvalC;
else
cout << "Invalid unit" << endl;
+ cout << TvalC << " " << TvalF << " " << Wspeed << " " << Wchill << endl;
+ cout << FtoCfunc;
cout << endl;
- cout << TvalC << " " << TvalF << " ";
}
-// Converts Fahrenheit to Celsius
-void FtoCfunc(signed int FtoCval)
-{
- FtoCval = (TvalF - 32) * (5 / 9);
- TvalC = FtoCval;
- cout << TvalC;
-}
+
+
+
+
// Converts Celsius to Fahrenheit
-void CtoFfunc(signed int CtoFval)
+void CtoFfunc(float CtoFval)
{
CtoFval = (9 / 5) * TvalC + 32;
- TvalF = CtoFval;
- cout << TvalF;
+ //TvalF = CtoFval;
+ //cout << TvalF;
}
// Converts Windspeed and Temp to Winchill
-void Wchfunc(signed int Wchill)
+void Wchfunc(float Wchill)
{
- Wchill = 35.74 + .6215 * TvalF - 35.75 * (pow (Wspeed, 0.16)) + 0.4275 * TvalF * (pow (Wspeed, 0.16));
- cout << 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