diff options
| author | Birducken <[email protected]> | 2022-11-07 20:55:51 -0800 |
|---|---|---|
| committer | Birducken <[email protected]> | 2022-11-07 20:55:51 -0800 |
| commit | d884b1a36aaddb9883074b84c77cb09e7ab8895b (patch) | |
| tree | a86b4aded93cc565ebe96e29b5b2db39be375f90 | |
| parent | Added output. (diff) | |
| download | cst116-lab2-stark-d884b1a36aaddb9883074b84c77cb09e7ab8895b.tar.xz cst116-lab2-stark-d884b1a36aaddb9883074b84c77cb09e7ab8895b.zip | |
Added comments.
| -rw-r--r-- | BlankConsoleLab/cst116-lab2-stark.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/BlankConsoleLab/cst116-lab2-stark.cpp b/BlankConsoleLab/cst116-lab2-stark.cpp index 3f7d716..04971a1 100644 --- a/BlankConsoleLab/cst116-lab2-stark.cpp +++ b/BlankConsoleLab/cst116-lab2-stark.cpp @@ -22,13 +22,15 @@ int main() { float cTemp, fTemp, windS, windC; cout << "Welcome to Cold Calculator v0.3" << endl; - + + //input inputTemp(cTemp, fTemp); inputWind(windS); windC = windChillCalc(fTemp, windS); + //output cout << "Calculations complete:" << endl; - cout << setw(15) << "Celcius" << setw(15) << "Fahrenheit" << setw(15) << "Wind Speed" << setw(15) << "Wind Chill" << endl; + cout << setw(15) << "Celcius" << setw(15) << "Fahrenheit" << setw(15) << "Wind Speed" << setw(15) << "Wind Chill" << endl; //Header column cout << setw(15) << cTemp << setw(15) << fTemp << setw(15) << windS << setw(15) << windC << endl; } @@ -84,6 +86,7 @@ float tempConverter(float temp, bool dirc) { return cTemp; } +//Gets wind speed and passes it back through reference void inputWind(float& windS) { cout << "What is the wind speed in miles per hour (0 - 231)" << endl; do { @@ -97,6 +100,6 @@ void inputWind(float& windS) { float windChillCalc(float fTemp, float windS) { float windC; - windC = 35.74 + (0.6125 * fTemp) - (35.75 * pow(windS, 0.16)) + (0.4275 * fTemp * pow(windS, 0.16)); + windC = 35.74 + (0.6125 * fTemp) - (35.75 * pow(windS, 0.16)) + (0.4275 * fTemp * pow(windS, 0.16)); //Formula from https://www.weather.gov/media/epz/wxcalc/windChill.pdf return windC; } |