diff options
| author | Joseph Williams <[email protected]> | 2022-11-09 11:41:49 -0800 |
|---|---|---|
| committer | Joseph Williams <[email protected]> | 2022-11-09 11:41:49 -0800 |
| commit | 48de5e495fb2076fa6a7fc7db4ba0d8370fcd391 (patch) | |
| tree | 482c7e230d5bbf5844dbfd041ecad8b25811d8ad /BlankConsoleLab/CST116_Lab2_Williams.cpp | |
| parent | finished writing code. have not tested anything because it's currently 12:43 ... (diff) | |
| download | cst116-lab2-allthenamesaretaken3141-master.tar.xz cst116-lab2-allthenamesaretaken3141-master.zip | |
Diffstat (limited to 'BlankConsoleLab/CST116_Lab2_Williams.cpp')
| -rw-r--r-- | BlankConsoleLab/CST116_Lab2_Williams.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/BlankConsoleLab/CST116_Lab2_Williams.cpp b/BlankConsoleLab/CST116_Lab2_Williams.cpp index e622b07..48689e4 100644 --- a/BlankConsoleLab/CST116_Lab2_Williams.cpp +++ b/BlankConsoleLab/CST116_Lab2_Williams.cpp @@ -104,7 +104,7 @@ bool isNumber(string str) { // 0: The user entered the temperature in F // 1: The user entered the temperature in C float getTemp(int& unit) { - vector <tuple<string, int, bool> > asktext = {make_tuple("Please enter the current temperature followed by its unit (", 15, 0), make_tuple("[F]ahrenheit", 11, 0), make_tuple(" or ", 15, 0), make_tuple("[C]elcius", 11, 0), make_tuple("): ", 15, 0)}; + vector <tuple<string, int, bool> > asktext = {make_tuple("Please enter the current temperature followed by its unit (", 15, 0), make_tuple("Fahrenheit", 11, 0), make_tuple(" or ", 15, 0), make_tuple("Celcius", 11, 0), make_tuple("): ", 15, 0)}; float temp; while (true) { @@ -271,14 +271,17 @@ int main() kphWind = wind; } - // Calculate the wind chill. The wind chill calculator uses Imperial units and I just convert it to Celcius. + // Calculate the wind chill. The wind chill calculator uses Imperial units, and I just convert it to Celcius. fChill = windChill(fTemp, mphWind); cChill = dftodc(fChill); // Print all the output, using needlessly complicated functions that I'm too stubborn to refine. - vector <tuple <string, int, bool> > tempOut = { make_tuple("The temperature is ", 15, 0), make_tuple(to_string(fTemp) + " degrees Fahrenheit", 11, 0), make_tuple(", or ", 15, 0), make_tuple(to_string(cTemp) + " degrees Celcius", 11, 0), make_tuple(".", 15, 0), }; - vector <tuple <string, int, bool> > windOut = { make_tuple("The wind speed is ", 15, 0), make_tuple(to_string(mphWind) + " miles per hour", 11, 0), make_tuple(", or ", 15, 0), make_tuple(to_string(kphWind) + " kilometers per hour", 11, 0), make_tuple(".", 15, 0), }; - vector <tuple <string, int, bool> > chillOut = { make_tuple("The wind chill is ", 15, 0), make_tuple(to_string(fChill) + " degrees Fahrenheit", 11, 0), make_tuple(", or ", 15, 0), make_tuple(to_string(cChill) + " degrees Celcius", 15, 0), make_tuple(".", 15, 0), }; + vector <tuple <string, int, bool> > tempOut = { make_tuple("The temperature is ", 15, 0), make_tuple(to_string(fTemp) + " degrees Fahrenheit", 11, 0), make_tuple(", or ", 15, 0), make_tuple(to_string(cTemp) + " degrees Celcius", 11, 0), make_tuple(".", 15, 1), }; + vector <tuple <string, int, bool> > windOut = { make_tuple("The wind speed is ", 15, 0), make_tuple(to_string(mphWind) + " miles per hour", 11, 0), make_tuple(", or ", 15, 0), make_tuple(to_string(kphWind) + " kilometers per hour", 11, 0), make_tuple(".", 15, 1), }; + vector <tuple <string, int, bool> > chillOut = { make_tuple("The wind chill is ", 15, 0), make_tuple(to_string(fChill) + " degrees Fahrenheit", 11, 0), make_tuple(", or ", 15, 0), make_tuple(to_string(cChill) + " degrees Celcius", 11, 0), make_tuple(".", 15, 1), }; + multiColorPrint(tempOut); + multiColorPrint(windOut); + multiColorPrint(chillOut); return 0; } |