From f905ee265a8fef28ef32c2296c88921b18362a83 Mon Sep 17 00:00:00 2001 From: Musa Ahmed Date: Tue, 4 Oct 2022 17:25:02 -0700 Subject: Edited comments --- CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'CST116-Ch5-Debugging') diff --git a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp index 851932d..e7604fb 100644 --- a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp +++ b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp @@ -1,10 +1,10 @@ /******************************************************************** -* File: CST116-Ch5-Debugging.cpp +* File: Chap_5_Debugging.cpp * * General Instructions: Complete each step before proceeding to the * next. * -* Debugging Exercise 1 +* Debugging Exercise 1 (Skipped because didn't work) * * 1) On the lines indicated in the code below, insert a breakpoint. * 2) With the program not in debugging mode, start debugging by @@ -16,6 +16,7 @@ * 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. @@ -30,6 +31,9 @@ * * 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. @@ -38,11 +42,23 @@ * 5) Notice that the current line of execution is now at the * calculation. * 6) Look at your watch. What is the value of money? + + money 123.449997 float + * 7) Hover your mouse pointer over raise. What is its value? + + raise 0.100000001 float + * 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. + + - The calculation only multiplies the money by the raise, + when it should actually be multiplying it by raise + 1. + Right now we are only getting the value that the money + shoudl be increases by. +* * * Debugging Exercise 3 * @@ -57,6 +73,8 @@ * ********************************************************************/ +// Name: Musa Ahmed, Course: CST116, Lab # 0, Learn how to debug and how to use an IDE as well as GitHub + #include #include using std::cout; @@ -68,6 +86,7 @@ int main() float money = 123.45F; float raise; + cout << "You have $"; cout << money << endl; @@ -76,7 +95,8 @@ int main() cout << "Enter percent raise: "; cin >> raise; - money = money * raise; + money = (money * (raise + 1)); + cout << "After your raise you have $"; cout << money << endl; -- cgit v1.2.3