diff options
| author | jacobdw22 <[email protected]> | 2022-11-11 13:33:45 -0800 |
|---|---|---|
| committer | jacobdw22 <[email protected]> | 2022-11-11 13:33:45 -0800 |
| commit | 28958d5436fe412491250b12992ea7a0f7710a77 (patch) | |
| tree | 077ee7a590018ec8de393436aca47e78c3ecbe0f | |
| parent | Very last changes, I swear (diff) | |
| download | cst116-lab2-jacobdw22-master.tar.xz cst116-lab2-jacobdw22-master.zip | |
| -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) } |