summaryrefslogtreecommitdiff
path: root/BlankConsoleLab
diff options
context:
space:
mode:
authorJoseph Williams <[email protected]>2022-11-09 11:41:49 -0800
committerJoseph Williams <[email protected]>2022-11-09 11:41:49 -0800
commit48de5e495fb2076fa6a7fc7db4ba0d8370fcd391 (patch)
tree482c7e230d5bbf5844dbfd041ecad8b25811d8ad /BlankConsoleLab
parentfinished writing code. have not tested anything because it's currently 12:43 ... (diff)
downloadcst116-lab2-allthenamesaretaken3141-master.tar.xz
cst116-lab2-allthenamesaretaken3141-master.zip
holy crap everything worked on the first try. that has actually never happened before.HEADmaster
Diffstat (limited to 'BlankConsoleLab')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj1
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj.filters3
-rw-r--r--BlankConsoleLab/CST116_Lab2_Williams.cpp13
-rw-r--r--BlankConsoleLab/CST116_Lab2_Williams_Run.txt15
4 files changed, 27 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj
index 6ee166d..58664f6 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj
@@ -143,6 +143,7 @@
</ItemGroup>
<ItemGroup>
<Text Include="CST116_Lab2_Williams_Pseudocode.txt" />
+ <Text Include="CST116_Lab2_Williams_Run.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
index ca64071..21212f6 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
@@ -23,5 +23,8 @@
<Text Include="CST116_Lab2_Williams_Pseudocode.txt">
<Filter>Source Files</Filter>
</Text>
+ <Text Include="CST116_Lab2_Williams_Run.txt">
+ <Filter>Source Files</Filter>
+ </Text>
</ItemGroup>
</Project> \ No newline at end of file
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;
}
diff --git a/BlankConsoleLab/CST116_Lab2_Williams_Run.txt b/BlankConsoleLab/CST116_Lab2_Williams_Run.txt
new file mode 100644
index 0000000..fea6830
--- /dev/null
+++ b/BlankConsoleLab/CST116_Lab2_Williams_Run.txt
@@ -0,0 +1,15 @@
+Please enter the current temperature followed by its unit (Fahrenheit or Celcius): thirty-four degrees celcius
+Oh no! Something went wrong. Make sure you enter a number and a unit.
+Please enter the current temperature followed by its unit (Fahrenheit or Celcius): 93 C
+Oh no! Something went wrong. Make sure you enter a temperature between -80 and 121 Fahrenheit (-62 and 49.5 Celcius).
+Please enter the current temperature followed by its unit (Fahrenheit or Celcius): 121.1 fahrenheit
+Oh no! Something went wrong. Make sure you enter a temperature between -80 and 121 Fahrenheit (-62 and 49.5 Celcius).
+Please enter the current temperature followed by its unit (Fahrenheit or Celcius): -54 celcius
+Please enter the current wind speed followed by its unit (miles per hour or kilometers per hour): 1123 miles per hour
+Oh no! Something went wrong. Make sure you enter a wind speed between 0 and 231 miles per hour (0 and 370 kilometers per hour).
+Please enter the current wind speed followed by its unit (miles per hour or kilometers per hour): 2543 kph
+Oh no! Something went wrong. Make sure you enter a wind speed between 0 and 231 miles per hour (0 and 370 kilometers per hour).
+Please enter the current wind speed followed by its unit (miles per hour or kilometers per hour): 93 kilometers per hour
+The temperature is -65.199997 degrees Fahrenheit, or -54.000000 degrees Celcius.
+The wind speed is 57.799877 miles per hour, or 93.000000 kilometers per hour.
+The wind chill is -126.546791 degrees Fahrenheit, or -88.081543 degrees Celcius. \ No newline at end of file