From d0f7378948f4663308d1eab258cad74a7a34079e Mon Sep 17 00:00:00 2001 From: Trevor Bouchillon Date: Mon, 7 Nov 2022 18:56:15 -0800 Subject: Added stuff --- BlankConsoleLab/BlankConsoleLab.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'BlankConsoleLab/BlankConsoleLab.cpp') 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; } -- cgit v1.2.3