diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 54bd036..1a0091d 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -9,11 +9,13 @@ using std::cout; using std::cin; using std::endl; -int UserInputTemp; +float UserInputTemp; +float WindSpeed; -int CelciusToFarenheit(int Celcius2Farenheit) { + +float CelciusToFarenheit(float Celcius2Farenheit) { Celcius2Farenheit = (UserInputTemp * (9 / 5)) + 32; - return UserInputTemp; + return Celcius2Farenheit; } int main() @@ -21,8 +23,24 @@ int main() cout << "Please enter a temperature in Celcius: "; cin >> UserInputTemp; - cout << CelciusToFarenheit(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 << "Please enter a wind speed in Miles Per Hour: "; + cin >> WindSpeed; + while (WindSpeed < 0 || WindSpeed > 231) { + cout << "Please enter a wind speed between 0 and 231 Miles Per Hour" << endl; + cout << "Please enter a wind speed in Miles Per Hour: "; + cin >> WindSpeed; + } + + cout << "The temperature you entered is " << CelciusToFarenheit(UserInputTemp) << " degrees in Farenheit." << endl; + return 0; } |