summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorTaylor Rogers <[email protected]>2022-11-07 23:04:02 -0800
committerTaylor Rogers <[email protected]>2022-11-07 23:04:02 -0800
commitda3de88993895d2f3e7ec7640340c6f7fbafc7fe (patch)
treef98ba1f635829e4ee576d6baf0e03dc324748ed3 /BlankConsoleLab/BlankConsoleLab.cpp
parentStruggling (diff)
downloadcst116-lab2-taylorrog-da3de88993895d2f3e7ec7640340c6f7fbafc7fe.tar.xz
cst116-lab2-taylorrog-da3de88993895d2f3e7ec7640340c6f7fbafc7fe.zip
Finished the basic inputs
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp93
1 files changed, 91 insertions, 2 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 59e71cf..734c153 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -35,11 +35,14 @@
#include <iostream>
#include <math.h>
+#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
+using std::setw;
+
const int Fmax = 121;
signed const int Fmin = -80;
@@ -64,26 +67,112 @@ float FtoCfunc(float FtoCval)
int main()
{
+
+ // Temp unit selection
cout << "Please enter F for Fahrenheit or C for Celsius: ";
cin >> Tunit;
cout << endl;
cout << "Please enter temperature: ";
+ // Temp input in F
if (Tunit == 70)
{
cin >> TvalF;
+ while (TvalF < Fmin)
+ {
+ cout << "Please enter a value greater than " << Fmin << ": ";
+ cin >> TvalF;
+
+ while (TvalF > Fmax)
+ {
+ cout << "Please enter a value less than " << Fmax << ": ";
+ cin >> TvalF;
+ }
+ }
+
+ while (TvalF > Fmax)
+ {
+ cout << "Please enter a value less than " << Fmax << ": ";
+ cin >> TvalF;
+
+ while (TvalF > Fmin)
+ {
+ cout << "Please enter a value greater than " << Fmin << ": ";
+ cin >> TvalF;
+ }
+ }
}
-
+ // Temp input in C
else if (Tunit == 67)
+ {
cin >> TvalC;
+ while (TvalC < Cmin)
+ {
+ cout << "Please enter a value greater than " << Cmin << ": ";
+ cin >> TvalC;
+
+ while (TvalC > Cmax)
+ {
+ cout << "Please enter a value less than " << Cmax << ": ";
+ cin >> TvalC;
+ }
+ }
+
+ while (TvalC > Cmax)
+ {
+ cout << "Please enter a value less than " << Cmax << ": ";
+ cin >> TvalC;
+
+ while (TvalC > Cmin)
+ {
+ cout << "Please enter a value greater than " << Cmin << ": ";
+ cin >> TvalC;
+ }
+ }
+ }
+
else
cout << "Invalid unit" << endl;
- cout << TvalC << " " << TvalF << " " << Wspeed << " " << Wchill << endl;
+
+ //Windspeed
+ cout << "Please enter the windpeed in Miles Per Hour: ";
+ cin >> Wspeed;
+
+ while (Wspeed < Wmin)
+ {
+ cout << "Please enter a value greater than " << Wmin << ": ";
+ cin >> Wspeed;
+
+ while (Wspeed > Wmax)
+ {
+ cout << "Please enter a value less than " << Wmax << ": ";
+ cin >> Wspeed;
+ }
+ }
+
+ while (Wspeed > Wmax)
+ {
+ cout << "Please enter a value less than " << Wmax << ": ";
+ cin >> Wspeed;
+
+ while (Wspeed > Wmin)
+ {
+ cout << "Please enter a value greater than " << Wmin << ": ";
+ cin >> Wspeed;
+ }
+ }
+
+ 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;