diff options
| author | Anibal LopezBonilla <[email protected]> | 2022-10-26 20:50:04 -0700 |
|---|---|---|
| committer | Anibal LopezBonilla <[email protected]> | 2022-10-26 20:50:04 -0700 |
| commit | 2b7c299297e1ccbfd19234c1f81b5563a6a7a1e9 (patch) | |
| tree | 13d1d178f68b05187307a2636ab14c7572cd8c12 | |
| parent | Push 2 (diff) | |
| download | cst116-ch10-debugging-lopez-bonilla-2b7c299297e1ccbfd19234c1f81b5563a6a7a1e9.tar.xz cst116-ch10-debugging-lopez-bonilla-2b7c299297e1ccbfd19234c1f81b5563a6a7a1e9.zip | |
| -rw-r--r-- | CST116-Ch10-Debugging-Output.txt | 24 | ||||
| -rw-r--r-- | CST116-Ch10-Debugging-Pseudocode.txt | 48 | ||||
| -rw-r--r-- | CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 9 |
3 files changed, 75 insertions, 6 deletions
diff --git a/CST116-Ch10-Debugging-Output.txt b/CST116-Ch10-Debugging-Output.txt new file mode 100644 index 0000000..edf594d --- /dev/null +++ b/CST116-Ch10-Debugging-Output.txt @@ -0,0 +1,24 @@ +Please enter your first name: a + +Please enter your last name: s + + + Welcome a s! + Hope all is well + + x y z + + 0 100 100 + 1 101 102 + 2 102 104 + 3 103 106 + 4 104 108 + 5 105 110 + 6 106 112 + 7 107 114 + 8 108 116 + 9 109 118 + +C:\Users\speed\source\repos\cst116-ch10-debugging-Lopez-Bonilla\CST116-Ch10-Debugging\x64\Debug\CST116-Ch10-Debugging.exe (process 53964) exited with code 0. +To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. +Press any key to close this window . . . diff --git a/CST116-Ch10-Debugging-Pseudocode.txt b/CST116-Ch10-Debugging-Pseudocode.txt new file mode 100644 index 0000000..03a48ab --- /dev/null +++ b/CST116-Ch10-Debugging-Pseudocode.txt @@ -0,0 +1,48 @@ +Program Begins + +Constant variable SIZE is set to 10 + +int arrays varX, varY, varZ are declared and set to SIZE + +Functions calls GetAndDisplayWelcomeInfo, FunctionOne, FunctionTwo and PrintFunction are declared. + +Function GetAndDisplayWelcomeInfo starts here + +Character array name is declared. + +Display Please Enter your first name +Enter First Name + +Display Please enter your last name + +enter Last name + +Display Welcome (name goes here) Hope all is well + +Function Ends here + + +Function FunctionOne starts here + +For loop is done to count the x in the varX array + +For loop is done to produce varY by adding 100 to the existing x + +Function ends here + + +FunctionTwo starts here + +varX array 1 is += -99 + +For loop is done to produce varZ variable by adding varX and varY + +Function ends here + +PrintFunction starts here + +integer x is declared + +Display in three columns + +for loop is done to produce the numbers of varX, varY, varZ
\ No newline at end of file diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp index 88f2087..2eecbee 100644 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp @@ -80,7 +80,7 @@ using std::setw; void GetAndDisplayWelcomeInfo();
void FunctionOne(int varX[], int varY[]);
-void FunctionTwo( int varX[], const int varY[], int varZ[]);
+void FunctionTwo(const int varX[], const int varY[], int varZ[]);
void PrintFunction(const int varX[], const int varY[],
const int varZ[]);
@@ -100,11 +100,9 @@ int main() // Breakpoint 3
// Put breakpoint on the following line
FunctionTwo(varX, varY, varZ);
- varZ[0] = -99;
PrintFunction(varX, varY, varZ);
return 0;
-
}
void GetAndDisplayWelcomeInfo()
{
@@ -131,9 +129,8 @@ void FunctionOne(int varX[], int varY[]) for (int x = 0; x < SIZE; x++)
varY[x] = x + 100;
}
-void FunctionTwo(int varX[], const int varY[], int varZ[])
+void FunctionTwo(const int varX[], const int varY[], int varZ[])
{
- varX[1] += 99;
for (int x = 0; x < SIZE; x++) // Notice the const SIZE here
varZ[x] = varX[x] + varY[x];
}
@@ -148,4 +145,4 @@ void PrintFunction(const int varX[20], const int varY[20], cout << "\t" << setw(3) << varX[x]
<< "\t " << varY[x]
<< "\t " << varZ[x] << endl;
-}
+}
\ No newline at end of file |