diff options
| author | Joseph Williams <[email protected]> | 2022-10-15 12:10:31 -0700 |
|---|---|---|
| committer | Joseph Williams <[email protected]> | 2022-10-15 12:10:31 -0700 |
| commit | 52eed13aecc26e1d7f4f47cf9532eb74bdb5016a (patch) | |
| tree | 5a65f3d7ca457817b240bf6f580d72f963c59340 /BlankConsoleLab | |
| parent | Completed step 2-4 (compute the gravitational force on the kite). Improved co... (diff) | |
| download | cst116-lab1-allthenamesaretaken3141-master.tar.xz cst116-lab1-allthenamesaretaken3141-master.zip | |
Diffstat (limited to 'BlankConsoleLab')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 6 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj.filters | 10 | ||||
| -rw-r--r-- | BlankConsoleLab/CST116_Lab1_Williams.cpp (renamed from BlankConsoleLab/BlankConsoleLab.cpp) | 2 | ||||
| -rw-r--r-- | BlankConsoleLab/CST116_Lab1_Williams_PSEUDOCODE.txt | 32 | ||||
| -rw-r--r-- | BlankConsoleLab/CST116_Lab1_Williams_RUN.txt | 19 |
5 files changed, 66 insertions, 3 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj index d2e3ee2..0ee69d7 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj @@ -139,7 +139,11 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="BlankConsoleLab.cpp" /> + <ClCompile Include="CST116_Lab1_Williams.cpp" /> + </ItemGroup> + <ItemGroup> + <Text Include="CST116_Lab1_Williams_PSEUDOCODE.txt" /> + <Text Include="CST116_Lab1_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 aca1dd9..747a21a 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters @@ -15,8 +15,16 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="BlankConsoleLab.cpp"> + <ClCompile Include="CST116_Lab1_Williams.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> + <ItemGroup> + <Text Include="CST116_Lab1_Williams_RUN.txt"> + <Filter>Source Files</Filter> + </Text> + <Text Include="CST116_Lab1_Williams_PSEUDOCODE.txt"> + <Filter>Source Files</Filter> + </Text> + </ItemGroup> </Project>
\ No newline at end of file diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/CST116_Lab1_Williams.cpp index 5d3d070..ec2318c 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/CST116_Lab1_Williams.cpp @@ -58,7 +58,7 @@ float getWidthOrHeight(string d) while (true) { multiColorPrint(text); - if (cin >> input && 1 <= input <= 400) //This feels so wrong but it does in fact work. + if (cin >> input && input >= 1 && input <= 400) //This feels so wrong but it does in fact work. { break; } diff --git a/BlankConsoleLab/CST116_Lab1_Williams_PSEUDOCODE.txt b/BlankConsoleLab/CST116_Lab1_Williams_PSEUDOCODE.txt new file mode 100644 index 0000000..ec61e01 --- /dev/null +++ b/BlankConsoleLab/CST116_Lab1_Williams_PSEUDOCODE.txt @@ -0,0 +1,32 @@ +program start: + +find hConsole to do black magic color printing stuff + +define (void) colorPrint and (void) multiColorPrint + +define (float) getWidthOrHeight, because both inputs do the same thing: + loop forever: + ask the user to input the width or height of their kite in cm + get user input + if the input is a float AND the input is in (1, 400): + break out of the loop + else: + tell the user their input needs to be a number between 1 and 400 + repeat the loop + + return width/height + +main: + say hi to the user + + get width and height in cm from the user and assign them to variables + + compute the area in m^2 and tell it to the user + + compute the aspect ratio and tell it to the user + if the aspect ratio is less than 1 or more than 5, warn the user that their kite may be unstable + + compute the mass of the kite in kg and tell it to the user + + compute the gravitational pull on the kite in newtons and tell it to the user +program end
\ No newline at end of file diff --git a/BlankConsoleLab/CST116_Lab1_Williams_RUN.txt b/BlankConsoleLab/CST116_Lab1_Williams_RUN.txt new file mode 100644 index 0000000..ba32f5c --- /dev/null +++ b/BlankConsoleLab/CST116_Lab1_Williams_RUN.txt @@ -0,0 +1,19 @@ +Devnote: The program prints multicolored text which you can't see in a .txt file. I'd reccommend running it yourself if you weren't planning to already. + +Welcome to Kite Calculator, can I take your order. +Let's start with getting the dimensions of your kite. +Please enter the width of your kite in cm: 420 +Oh no! It looks like something went wrong. +Please make sure your width is a number between 1 and 400 and try again. +Please enter the width of your kite in cm: 69 +Please enter the height of your kite in cm: 273 + +Now, let's do some math. +Your kite is 69.000000cm wide and 273.000000cm high. +I'm sure it's beautiful. + +Your kite has an area of 0.941850 square meters. + +Your kite has an aspect ratio of 0.252747. Your kite is too wide, and will be unstable. Consider widening it or flying it sideways. +Your kite has a mass of 0.127150 kilograms. +The gravitational pull on your kite is 1.246958 newtons.
\ No newline at end of file |