diff options
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 9 | ||||
| -rw-r--r-- | Chap_11_Report.txt | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp index 84e77eb..ba5ea16 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp @@ -31,9 +31,16 @@ * and notice how Visual Studio has rewritten your output file * and asks if you would like to reload the file (select Yes). * 9) Examine the contents of both the input and the output file. + +There is an additional line of what seems to be additional memory. + * 10) Fix all the problems in your code that exist in relation to * the output. Verify that your output is appropriate for your input file. + +Done, there was an issue in the for loop, as the index started at 0, +but it went one over than what it was supposed to. + * 11) Build and execute your code until you have all errors * removed and all the output is correct. * @@ -135,7 +142,7 @@ int ReadData(ifstream& inFile, ofstream& outFile, char name[][MAX], int age[]) void WriteOutputFile(ofstream& outFile, char name[][MAX], int age[], int counter) { outFile << " Here is the Output File" << endl; - for (int r = 0; r <= counter; r++) + for (int r = 0; r < counter; r++) { outFile << setiosflags(ios::left) << setw(25) << name[r] << setw(4) diff --git a/Chap_11_Report.txt b/Chap_11_Report.txt index c17cff1..cda3f30 100644 --- a/Chap_11_Report.txt +++ b/Chap_11_Report.txt @@ -10,7 +10,6 @@ Cheryl 32 Kim 16 Dave 25 Will 34 - 13975552 ** Total Records: 11 ** |