diff options
Diffstat (limited to 'BlankConsoleLab/cst116-lab2-wilson.cpp')
| -rw-r--r-- | BlankConsoleLab/cst116-lab2-wilson.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/BlankConsoleLab/cst116-lab2-wilson.cpp b/BlankConsoleLab/cst116-lab2-wilson.cpp index 2d29e7e..8c8ceda 100644 --- a/BlankConsoleLab/cst116-lab2-wilson.cpp +++ b/BlankConsoleLab/cst116-lab2-wilson.cpp @@ -21,7 +21,8 @@ const float CMAX = 49.5; const float CMIN = -62; //Set values for minimum and maximum temperatures, both Fahrenheit and Celsius. -float CtoF(float Fahrenheit, float Celsius) { //float function so that it returns a float for Fahrenheit (more precise) +float CtoF(float Fahrenheit, float Celsius) //float function so that it returns a float for Fahrenheit (more precise) +{ Fahrenheit = (Celsius * 9.0 / 5.0) + 32.0; //Converts Celsius to Fahrenheit @@ -29,7 +30,8 @@ float CtoF(float Fahrenheit, float Celsius) { //float function so that it } -float WindSpeedFinder(float* windspeed) { //Float function to return float value +float WindSpeedFinder(float* windspeed) //Float function to return float value +{ Loop2: //Placeholder to loop back to @@ -47,7 +49,8 @@ Loop2: //Placeholder to loop back to } -float WindChill(float TEMP, float SPEED, float Chill) { //Converts wind speed and Fahrenheit to wind chill +float WindChill(float TEMP, float SPEED, float Chill) //Converts wind speed and Fahrenheit to wind chill +{ float x = 0.16; //placeholder value for equation (faster) @@ -71,11 +74,13 @@ int main() //Main function cout << "Please enter a temperature between -62 and 49.5 degrees Celsius: "; //Prompts user to enter a temperature in Celsius cin >> Celsius; //Reads in Celsius from the user input - if (Celsius <= CMAX && Celsius >= CMIN) { + if (Celsius <= CMAX && Celsius >= CMIN) + { cout << "\t" << Celsius << " Degrees Celsius is approximately " << CtoF(Fahrenheit, Celsius) << " Degrees Fahrenheit\n\n"; //if the value of Celsius is between the limits, the celsius to fahrenheit function will be run and returned, then printed } - else { + else + { goto Loop; //Goes back to placeholder to Loop in case of invalid response (past limits) } |