diff options
| author | Trevor Bouchillon <[email protected]> | 2022-11-07 18:56:15 -0800 |
|---|---|---|
| committer | Trevor Bouchillon <[email protected]> | 2022-11-07 18:56:15 -0800 |
| commit | d0f7378948f4663308d1eab258cad74a7a34079e (patch) | |
| tree | 90523265bdf957cc004af8f729463e6b4a6e72aa /BlankConsoleLab/BlankConsoleLab.cpp | |
| parent | Intial Commits (diff) | |
| download | cst116-lab2-daboochillin-d0f7378948f4663308d1eab258cad74a7a34079e.tar.xz cst116-lab2-daboochillin-d0f7378948f4663308d1eab258cad74a7a34079e.zip | |
Added stuff
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; } |