diff options
| author | JonCr <[email protected]> | 2022-11-10 23:59:24 -0800 |
|---|---|---|
| committer | JonCr <[email protected]> | 2022-11-10 23:59:24 -0800 |
| commit | c125861250c23e2368db1efaf0956dcce28c431d (patch) | |
| tree | 5e83f0a58775b0b10c380a6942f201f68cba22b4 | |
| parent | Limit wind speed (diff) | |
| download | cst116-lab2-cognitiveshadow-c125861250c23e2368db1efaf0956dcce28c431d.tar.xz cst116-lab2-cognitiveshadow-c125861250c23e2368db1efaf0956dcce28c431d.zip | |
Debugging
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 8b62456..f70e4dc 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -63,25 +63,25 @@ float getTemp(int& select) if (select == 1) { - while (temp < minC || temp > maxC) + while (temp < minF || temp > maxF) { cout << endl << "Enter temperature: "; cin >> temp; - if (temp < minC || temp > maxC) - cout << endl << "Please enter between " << minC << " and " << maxC << "." << endl; + if (temp < minF || temp > maxF) + cout << endl << "Please enter between " << minF << " and " << maxF << "." << endl; } } if (select == 2) { - while (temp < minF || temp > maxF) + while (temp < minC || temp > maxC) { cout << endl << "Enter temperature: "; cin >> temp; - if (temp < minF || temp > maxF) - cout << endl << "Please enter between " << minF << " and " << maxF << "." << endl; + if (temp < minC || temp > maxC) + cout << endl << "Please enter between " << minC << " and " << maxC << "." << endl; } } @@ -91,13 +91,13 @@ float calcTemp(float& Celsius) { float Fahrenheit = 0; - Fahrenheit = (9 / 5) * Celsius + 32; + Fahrenheit = 32 + ((9 * Celsius) / 5); return Fahrenheit; } float getWindSpeed() { - float windSpeed = 0; + float windSpeed = -100; { while (windSpeed < 0 || windSpeed > 231) |