diff options
| author | WilliamBishopCST116 <[email protected]> | 2022-10-03 13:09:32 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-03 13:09:32 -0700 |
| commit | 983e6b36e221a9cf772988e1cd6493138b453b3a (patch) | |
| tree | 022a47612e9a99411dbf6c4a4355c541f927f877 | |
| parent | Setting up GitHub Classroom Feedback (diff) | |
| download | cst116-ch5-debugging-bishop-983e6b36e221a9cf772988e1cd6493138b453b3a.tar.xz cst116-ch5-debugging-bishop-983e6b36e221a9cf772988e1cd6493138b453b3a.zip | |
Add files via upload
| -rw-r--r-- | CST116-CH5-Debugging-Text Output-Bishop.txt | 3 | ||||
| -rw-r--r-- | CST116-CH5Debugging-Bishop-Pseudocode.txt | 88 | ||||
| -rw-r--r-- | CST116-Ch5-Debugging.sln | 31 |
3 files changed, 122 insertions, 0 deletions
diff --git a/CST116-CH5-Debugging-Text Output-Bishop.txt b/CST116-CH5-Debugging-Text Output-Bishop.txt new file mode 100644 index 0000000..923513b --- /dev/null +++ b/CST116-CH5-Debugging-Text Output-Bishop.txt @@ -0,0 +1,3 @@ +You have $123.45
+Enter percent raise: .1
+After your raise you have $135.795
\ No newline at end of file diff --git a/CST116-CH5Debugging-Bishop-Pseudocode.txt b/CST116-CH5Debugging-Bishop-Pseudocode.txt new file mode 100644 index 0000000..0d7df2d --- /dev/null +++ b/CST116-CH5Debugging-Bishop-Pseudocode.txt @@ -0,0 +1,88 @@ +/********************************************************************
+* File: CST116-Ch5-Debugging.cpp
+*
+* General Instructions: Complete each step before proceeding to the
+* next.
+*
+* Debugging Exercise 1
+*
+* 1) On the lines indicated in the code below, insert a breakpoint.
+* 2) With the program not in debugging mode, start debugging by
+* using the "Step Into" tool.
+* 3) Click on the Watch1 tab.
+* 4) With the cursor in the Name column type money and press enter.
+* This adds a programmer defined watch on the variable money.
+* 5) Step Into until you reach the first cout statement. With
+* the current line being that cout statement, Step Into again.
+* 6) What happened? Where are we now? What is all of this nasty
+* looking code? I think we are at the second cout statement that recognized the output of our cin statement. We have not seen the cin statement yet.
+* 7) Remember, stepping into a predefined routine takes you to the
+* code for that routine. If the debugger can't find the code it
+* will show the assembly code for that routine.
+* 8) How do we get out of this mess? Use the "Step Out" tool. We need to fix the code so that we can understand it better and see it more simpler.
+* 9) In Visual Studio you will be taken back to the same cout
+* statement. Use the Step Over tool to take you to the next
+* line.
+* 10) Step over the next cout statement. Now look at the console
+* window. What was printed? We see that we have the next output of what is the Raise we put in and that was the third statement.
+* 11) Select Stop Debugging either from the Debug menu or from your
+* toolbar.
+*
+* Debugging Exercise 2
+*
+* 1) With the program stopped, run to Breakpoint 1 by selecting
+* the Start Debugging menu option, toolbar icon or press F5.
+* 2) Step over the cout.
+* 3) Step over the cin. Notice that you can now enter a value.
+* 4) Enter the value .1 and press enter.
+* 5) Notice that the current line of execution is now at the
+* calculation.
+* 6) Look at your watch. What is the value of money? 123.449997
+* 7) Hover your mouse pointer over raise. What is its value? raise = 0.100000001
+* 8) Step over the calculation. Notice the watch on money is now
+* red. This designates that the variable just changed its value.
+* 9) What happened to our money? I thought a raise was supposed
+* to increase our money? Stop debugging and fix the calculation.
+*
+* Debugging Exercise 3
+*
+* 1) Choose Disable All Breakpoints from the Debug menu.
+* 2) With the cursor on the calculation, Run to Cursor. Remember
+* that the Run to Cursor tool can be accessed by right clicking
+* in the code window and choosing the correct menu option.
+* 3) Step over the calculation and verify that this time
+* you end up with more money than before the raise. We have more money
+*
+* 4) Stop debugging. Now run the entire program by choosing the menu
+* option Start Without Debugging.
+*
+********************************************************************/
+This up above are just comments.
+
+#include <iostream> Here we have the different information that is the start of the stream text to start the code
+#include <iomanip> We have the different lines that start the different work of the code and the multiple inputs to start the code.
+using std::cout; Here we can use the cout command
+using std::cin; Here we have the work of the cin command
+using std::endl; Here we can use the end line command
+
+int main() This is the start of the main function.
+{
+ float money = 123.45F; Here we have the money float with the value of it.
+ float raise; Here we have the raise float and the declaration of it.
+
+ cout << "You have $"; Here we have the cout of the the amount of money we have
+ cout << money << endl; Here we cout the cout float
+
+ // Breakpoint 1
+ // Put a breakpoint on the following line
+ cout << "Enter percent raise: "; I put a breakpoint here and followed the comments in the function. We have the cout of the enter percent raise.
+ cin >> raise; Here we have the work of what is the cin for the raise float
+
+ money = (money * raise)+money; Here we calculate our raise in the function.
+
+
+ cout << "After your raise you have $"; Here we cout the raise and the money follows it.
+ cout << money << endl; Here we cout the money we have in the code and end the line.
+
+ return 0; This is the end of the code where we return 0.
+}
\ No newline at end of file diff --git a/CST116-Ch5-Debugging.sln b/CST116-Ch5-Debugging.sln new file mode 100644 index 0000000..61b265b --- /dev/null +++ b/CST116-Ch5-Debugging.sln @@ -0,0 +1,31 @@ +
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32804.467
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116-Ch5-Debugging", "CST116-Ch5-Debugging.vcxproj", "{656289CE-6A7B-4681-B61A-B8BD2CF9E712}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Debug|x64.ActiveCfg = Debug|x64
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Debug|x64.Build.0 = Debug|x64
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Debug|x86.ActiveCfg = Debug|Win32
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Debug|x86.Build.0 = Debug|Win32
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Release|x64.ActiveCfg = Release|x64
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Release|x64.Build.0 = Release|x64
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Release|x86.ActiveCfg = Release|Win32
+ {656289CE-6A7B-4681-B61A-B8BD2CF9E712}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {814ACEF9-6F20-4A06-B885-731651BC52DC}
+ EndGlobalSection
+EndGlobal
|