summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
author[email protected] <[email protected]>2022-11-09 14:48:46 -0800
committer[email protected] <[email protected]>2022-11-09 14:48:46 -0800
commit5b181e496450b6abddab5dfe57ad60912c425b08 (patch)
tree8226486a9e2a725d035742056ab111f3eb6ee635 /BlankConsoleLab/BlankConsoleLab.cpp
parentOops missed an input. My bad (diff)
downloadcst116-lab2-smith-benjamin-5b181e496450b6abddab5dfe57ad60912c425b08.tar.xz
cst116-lab2-smith-benjamin-5b181e496450b6abddab5dfe57ad60912c425b08.zip
Constants have been added!
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 9a2f8ab..5b2941c 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -8,6 +8,8 @@
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;
@@ -26,30 +28,30 @@ int main()
//Temperature value input
if (input == "C")
- cout << endl << endl << "Now please input a temperature between the range -61 to 49.5: ";
+ cout << endl << endl << "Now please input a temperature between the range " << temp_min_C << " to " << temp_min_C << ": ";
if (input == "F")
- cout << endl << endl << "Now please input a temperature between the range -80 to 121: ";
+ cout << endl << endl << "Now please input a temperature between the range " << temp_min_F << " to " << temp_max_F << ": ";
cin >> temperature;
if (input == "C") {
while (temperature < -62 || temperature > 49.5) {
- cout << "That input is invalid." << endl << "Your value must be between -62 and 49.5." << endl;
+ cout << "That input is invalid." << endl << "Your value must be between " << temp_min_C << " and " << temp_min_C << "." << endl;
cout << "Please input the temperature again: ";
cin >> temperature;
}
}
else {
while (temperature < -80 || temperature > 121) {
- cout << "That input is invalid." << endl << "Your value must be between -80 and 121." << endl;
+ cout << "That input is invalid." << endl << "Your value must be between " << temp_min_C << " and " << temp_min_C << "." << endl;
cout << "Please input the temperature again: ";
cin >> temperature;
}
}
//Wind Speed value input
- cout << endl << endl << "Now please input a wind speed between the range 0 to 231: ";
+ cout << endl << endl << "Now please input a wind speed between the range " << wind_min << " to " << wind_max << ": ";
cin >> wind_speed;
while (wind_speed < 0 || wind_speed > 231) {
- cout << "That input is invalid." << endl << "Your value must be between 0 and 231." << endl;
+ cout << "That input is invalid." << endl << "Your value must be between " << wind_min << " and " << wind_max << "." << endl;
cout << "Please input the wind speed again: ";
cin >> wind_speed;
}