aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..844b557
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,53 @@
+//
+// main.cpp
+// CST116-ch.5 debugging-Davis
+//
+// Levi Davis
+//
+
+// 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?
+// 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.
+// 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?
+// 11) Select Stop Debugging either from the Debug menu or from your
+// toolbar.
+#include <iostream>
+#include <iomanip>
+using std::cout;
+using std::cin;
+using std::endl;
+
+int main()
+{
+ float money = 123.45F;
+ float raise;
+
+ cout << "You have $";
+ cout << money << endl;
+
+
+ cout << "Enter percent raise: ";
+ cin >> raise;
+
+ money = money * raise;
+
+ cout << "After your raise you have $";
+ cout << money << endl;
+
+ return 0;
+}