summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 2a1caf0..9a2f8ab 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -9,37 +9,52 @@
using namespace std;
string input = "";
-float temperature = 0;
+float temperature = 0, wind_speed = 0;
int main()
{
- cout << "Before you input a temperature value, you must first determine if it's in fahrenheit or celcius." << endl;
- cout << "Please input 'F' for fahrenheit or 'C' for celcius: ";
+ //Temperature type input
+ cout << "Before you input a temperature value, you must first determine if it's in fahrenheit or celsius." << endl;
+ cout << "Please input 'F' for fahrenheit or 'C' for celsius: ";
cin >> input;
while (input != "F" && input != "C") {
cout << "That input is invalid." << endl;
cout << "Make sure your input is capitalized." << endl;
- cout << "Please input 'F' for fahrenheit or 'C' for celcius: ";
+ cout << "Please input 'F' for fahrenheit or 'C' for celsius: ";
cin >> input;
}
- cout << endl << endl << "Now please input the temperature: ";
+ //Temperature value input
+ if (input == "C")
+ cout << endl << endl << "Now please input a temperature between the range -61 to 49.5: ";
+ if (input == "F")
+ cout << endl << endl << "Now please input a temperature between the range -80 to 121: ";
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 << "Please input the temperature: ";
+ 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 << "Please input the temperature: ";
+ 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: ";
+ 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 << "Please input the wind speed again: ";
+ cin >> wind_speed;
+ }
+
+ //Convert Celsius to Fahrenheit
if (input == "C") {
temperature *= 1.8;
temperature += 32;