diff options
| author | Trevor Bouchillon <[email protected]> | 2022-11-08 18:44:31 -0800 |
|---|---|---|
| committer | Trevor Bouchillon <[email protected]> | 2022-11-08 18:44:31 -0800 |
| commit | 5dd21829704b6aaefc47f852f4e71bae0b6f3647 (patch) | |
| tree | 841e0920a79887ee8ed5a2b7022fef199bd9507c /BlankConsoleLab/BlankConsoleLab.cpp | |
| parent | Added stuff (diff) | |
| download | cst116-lab2-daboochillin-5dd21829704b6aaefc47f852f4e71bae0b6f3647.tar.xz cst116-lab2-daboochillin-5dd21829704b6aaefc47f852f4e71bae0b6f3647.zip | |
buffing out
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 34 |
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; } |