diff options
| author | jacobdw22 <[email protected]> | 2022-11-02 13:47:53 -0700 |
|---|---|---|
| committer | jacobdw22 <[email protected]> | 2022-11-02 13:47:53 -0700 |
| commit | d844f6ab2770938b76b64f9dca3627a0676fd328 (patch) | |
| tree | b93a53c8895c8ab94da6091691fcf6d26b57d2c0 | |
| parent | Finsihed WindSpeedFinder function (diff) | |
| download | cst116-lab2-jacobdw22-d844f6ab2770938b76b64f9dca3627a0676fd328.tar.xz cst116-lab2-jacobdw22-d844f6ab2770938b76b64f9dca3627a0676fd328.zip | |
simple changes
| -rw-r--r-- | BlankConsoleLab/cst116-lab2-wilson.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/BlankConsoleLab/cst116-lab2-wilson.cpp b/BlankConsoleLab/cst116-lab2-wilson.cpp index a8e2729..9b61ba9 100644 --- a/BlankConsoleLab/cst116-lab2-wilson.cpp +++ b/BlankConsoleLab/cst116-lab2-wilson.cpp @@ -29,7 +29,7 @@ float CtoF(float Fahrenheit, float Celsius) { //float function so that it return } -void WindSpeedFinder(int* windspeed) { //Float function to return float value +float WindSpeedFinder(float* windspeed) { //Float function to return float value Loop2: @@ -38,6 +38,7 @@ Loop2: if (*windspeed <= 231 && *windspeed >= 0) { cout << "\n\tThe windspeed is " << *windspeed << " mph." << endl; + return *windspeed; } else { goto Loop2; //Goes back to placeholder to Loop in case of invalid response (past limits) @@ -46,11 +47,23 @@ Loop2: } +float WindChill(float Fahrenheit, float* windspeed) { + + float Chill = 0.0; + + Chill = 35.74 + 0.6215 * Fahrenheit - 35.75 * pow(*windspeed, 0.16) + 0.4275 * Fahrenheit * pow(*windspeed, 0.16); + + return Chill; + +} + + int main() { float Celsius = 0.0; //Defines Celsius for the conversion function float Fahrenheit = 0.0; //Defines Fahrenheit for the conversion function - int windspeed = 0; + float windspeed = 0.0; //Defines windspeed + Loop: //Placeholder to loop back to @@ -67,5 +80,8 @@ int main() WindSpeedFinder(&windspeed); + + cout << "\n\tThe windchill is: " << WindChill(Fahrenheit, &windspeed) << endl; + } |