From d7255207489f27b9e4b7d526512e9e4bca027b96 Mon Sep 17 00:00:00 2001 From: Andrei F Date: Tue, 1 Nov 2022 22:43:05 -0700 Subject: Finished part 1 --- CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp') 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) -- cgit v1.2.3