summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 1a0091d..256ee34 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -11,6 +11,7 @@ using std::endl;
float UserInputTemp;
float WindSpeed;
+char CorF;
float CelciusToFarenheit(float Celcius2Farenheit) {
@@ -21,14 +22,33 @@ float CelciusToFarenheit(float Celcius2Farenheit) {
int main()
{
- cout << "Please enter a temperature in Celcius: ";
+ cout << "Please enter a temperature in Celcius or Farenheit: ";
cin >> UserInputTemp;
-
- while (UserInputTemp < -62 || UserInputTemp > 49.5) {
- cout << "Please enter a temperature between -62 and 49.5." << endl;
- cout << "Please enter a temperature in Celcius: ";
- cin >> UserInputTemp;
+ cout << "If you entered a temperature in Celcius please enter 'C' and if you entered a temperature in Farenheit please enter 'F'. ";
+ cin >> CorF;
+
+ while (CorF != 'C' && CorF != 'F') {
+ cout << "Please enter either 'C' or 'F': ";
+ cin >> CorF;
+ }
+ if (CorF == 'F') {
+ while (UserInputTemp < -80 || UserInputTemp > 121) {
+ cout << "Please enter a temperature between -80 and 121." << endl;
+ cout << "Please enter a temperature in Farenheit: ";
+ cin >> UserInputTemp;
+ }
}
+ else if (CorF == 'C') {
+ while (UserInputTemp < -62 || UserInputTemp > 49.5) {
+ cout << "Please enter a temperature between -62 and 49.5." << endl;
+ cout << "Please enter a temperature in Celcius: ";
+ cin >> UserInputTemp;
+ }
+ cout << "The temperature you entered is " << CelciusToFarenheit(UserInputTemp) << " degrees in Farenheit." << endl;
+ }
+
+
+
cout << "Please enter a wind speed in Miles Per Hour: ";
cin >> WindSpeed;
@@ -39,7 +59,7 @@ int main()
}
- cout << "The temperature you entered is " << CelciusToFarenheit(UserInputTemp) << " degrees in Farenheit." << endl;
+ //cout << "The temperature you entered is " << CelciusToFarenheit(UserInputTemp) << " degrees in Farenheit." << endl;
return 0;
}