From f8d7d4201e8b7f284254d2e8176a4e7efbcf97e5 Mon Sep 17 00:00:00 2001 From: Evan Date: Mon, 28 Nov 2022 19:05:53 -0800 Subject: done --- Ch 5 Debugging Project/Ch 5 Debugging Project.cpp | 30 +++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'Ch 5 Debugging Project/Ch 5 Debugging Project.cpp') diff --git a/Ch 5 Debugging Project/Ch 5 Debugging Project.cpp b/Ch 5 Debugging Project/Ch 5 Debugging Project.cpp index f4f97e4..98d4155 100644 --- a/Ch 5 Debugging Project/Ch 5 Debugging Project.cpp +++ b/Ch 5 Debugging Project/Ch 5 Debugging Project.cpp @@ -1,5 +1,5 @@ /******************************************************************** -* File: Chap_5_Debugging.cpp +* File: CST116-Ch5-Debugging.cpp * * General Instructions: Complete each step before proceeding to the * next. @@ -16,9 +16,6 @@ * 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? -* -* !add the reason! -* * 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. @@ -28,9 +25,9 @@ * line. * 10) Step over the next cout statement. Now look at the console * window. What was printed? -* -* !anwser! -* +* +* Enter percent raise +* * 11) Select Stop Debugging either from the Debug menu or from your * toolbar. * @@ -44,7 +41,13 @@ * 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 +* * 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 @@ -63,6 +66,11 @@ * ********************************************************************/ + +/* +I had a lot of problems trying to get the instuctions to work. +*/ + #include #include using std::cout; @@ -71,19 +79,27 @@ using std::endl; int main() { + //determinds how much money there is float money = 123.45F; + //defines the term raise float raise; + //displays in the command box "You have $" cout << "You have $"; + //diplays the amount of money that is defined cout << money << endl; // Breakpoint 1 // Put a breakpoint on the following line + + //displays "Enter percent raise" requires user input for the number cout << "Enter percent raise: "; cin >> raise; + //this is the equation used to calculate the raise amount money = money * raise; + //displayed the final result from the equation cout << "After your raise you have $"; cout << money << endl; -- cgit v1.2.3