From eca13dd9cf9772c73f10f6cdd2fbcefab66fec42 Mon Sep 17 00:00:00 2001 From: EdwardFine Date: Thu, 29 Sep 2022 15:21:15 -0700 Subject: Finished Debug Project --- Ch 5 Debugging Project/CST116-Debugging-Fine.cpp | 97 ++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Ch 5 Debugging Project/CST116-Debugging-Fine.cpp (limited to 'Ch 5 Debugging Project/CST116-Debugging-Fine.cpp') diff --git a/Ch 5 Debugging Project/CST116-Debugging-Fine.cpp b/Ch 5 Debugging Project/CST116-Debugging-Fine.cpp new file mode 100644 index 0000000..8522ad8 --- /dev/null +++ b/Ch 5 Debugging Project/CST116-Debugging-Fine.cpp @@ -0,0 +1,97 @@ +/******************************************************************** +* File: Chap_5_Debugging.cpp +* +* General Instructions: Complete each step before proceeding to the +* next. +* +* CST 116, Edward Fine, Lab0, debugging +* +* 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? +* So far, all I can see is that the money has been assigned its value of 123.45 +* and in the console it simply says "You have $". I don't see any messy code +* after stepping into cout< +#include +using std::cout; +using std::cin; +using std::endl; + +int main() +{ + float money = 123.45F; + float raise; + + cout << "You have $"; + cout << money << endl; + + // Breakpoint 1 + // Put a breakpoint on the following line + cout << "Enter percent raise (in decimal form): "; + cin >> raise; + raise = raise * money; + money = money + raise; + + cout << "After your raise you have $"; + cout << money << endl; + + return 0; +} \ No newline at end of file -- cgit v1.2.3