summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2022-11-09 14:51:40 -0800
committer[email protected] <[email protected]>2022-11-09 14:51:40 -0800
commit3b6ef8d438f84077e67190b06fcca42911e479df (patch)
tree14614b513242e0bb034f1bf7205fac8d0926ac8a
parentConstants have been added! (diff)
downloadcst116-lab2-smith-benjamin-3b6ef8d438f84077e67190b06fcca42911e479df.tar.xz
cst116-lab2-smith-benjamin-3b6ef8d438f84077e67190b06fcca42911e479df.zip
Errors fixed and formatting slightly improved
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 5b2941c..0dd2451 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -28,20 +28,22 @@ int main()
//Temperature value input
if (input == "C")
- cout << endl << endl << "Now please input a temperature between the range " << temp_min_C << " to " << temp_min_C << ": ";
+ cout << endl << endl << "Now please input a temperature between the range " << temp_min_C << " to " << temp_max_C << ": ";
if (input == "F")
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 " << temp_min_C << " and " << temp_min_C << "." << endl;
+ while (temperature < temp_min_C || temperature > temp_max_C) {
+ cout << endl;
+ cout << "That input is invalid." << endl << "Your value must be between " << temp_min_C << " and " << temp_max_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 " << temp_min_C << " and " << temp_min_C << "." << endl;
+ while (temperature < temp_min_F || temperature > temp_max_F) {
+ cout << endl;
+ cout << "That input is invalid." << endl << "Your value must be between " << temp_min_F << " and " << temp_max_F << "." << endl;
cout << "Please input the temperature again: ";
cin >> temperature;
}
@@ -50,7 +52,8 @@ int main()
//Wind Speed value input
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) {
+ while (wind_speed < wind_min || wind_speed > wind_max) {
+ cout << 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;