summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorTaylor Rogers <[email protected]>2022-11-05 14:06:25 -0700
committerTaylor Rogers <[email protected]>2022-11-05 14:06:25 -0700
commit5fdfbbd260d38a58bb5ef25b939e93b3c926b072 (patch)
tree2128878863bd4134d2149e5b882363e8b3506559 /BlankConsoleLab/BlankConsoleLab.cpp
parentAdded the first two functions (diff)
downloadcst116-lab2-taylorrog-5fdfbbd260d38a58bb5ef25b939e93b3c926b072.tar.xz
cst116-lab2-taylorrog-5fdfbbd260d38a58bb5ef25b939e93b3c926b072.zip
Added more to main and final function
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp47
1 files changed, 33 insertions, 14 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index e0fbdb0..b0c3124 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -31,15 +31,10 @@
// 10. Print headers "Temperature in F" , "Temperature in C", "Windpseed", "Windchill"
// 11. Print [TvalF] , [TvalC] , [Wspeed] , [Wchill]
//
-//
-//
-//
-//
-//
-//
#include <iostream>
+#include <math.h>
using std::cout;
@@ -47,8 +42,8 @@ using std::cin;
using std::endl;
char Tunit = 0;
-int TvalF = 0;
-int TvalC = 0;
+signed int TvalF = 0;
+signed int TvalC = 0;
int Wspeed = 0;
const int Fmax = 121;
@@ -58,21 +53,38 @@ signed const int Cmin = -62;
const int Wmax = 231;
const int Wmin = 0;
-void FtoCfunc(int FtoCval);
+void FtoCfunc(signed int FtoCval);
-void CtoFfunc(int CtoFval);
+void CtoFfunc(signed int CtoFval);
-void Wchfunc(int Wchill);
+void Wchfunc(signed int Wchill);
int main()
{
cout << "Please enter F for Fahrenheit or C for Celsius: ";
cin >> Tunit;
+ cout << endl;
+
+ cout << "Please enter temperature: ";
+
+ if (Tunit == 70)
+ cin >> TvalF;
+
+ else if (Tunit == 67)
+ cin >> TvalC;
+
+ else
+ cout << "Invalid unit" << endl;
+
+
+ cout << endl;
+
+ cout << TvalC << " " << TvalF << " ";
}
// Converts Fahrenheit to Celsius
-void FtoCfunc(int FtoCval)
+void FtoCfunc(signed int FtoCval)
{
FtoCval = (TvalF - 32) * (5 / 9);
TvalC = FtoCval;
@@ -80,9 +92,16 @@ void FtoCfunc(int FtoCval)
}
// Converts Celsius to Fahrenheit
-void CtoFfunc(int CtoFval)
+void CtoFfunc(signed int CtoFval)
{
CtoFval = (9 / 5) * TvalC + 32;
- CtoFval = TvalF;
+ TvalF = CtoFval;
cout << TvalF;
+}
+
+// Converts Windspeed and Temp to Winchill
+void Wchfunc(signed int 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