diff options
| author | Tim Pearse <[email protected]> | 2022-11-02 17:16:14 -0700 |
|---|---|---|
| committer | Tim Pearse <[email protected]> | 2022-11-02 17:16:14 -0700 |
| commit | 388e44271604002577b10841934d5f2c3cc5df1e (patch) | |
| tree | 0ba06e3587db28d2f6435f90d117dc96411c4c28 /CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | |
| parent | Initial commit (diff) | |
| download | cst116-ch11-debugging-legokid1503-388e44271604002577b10841934d5f2c3cc5df1e.tar.xz cst116-ch11-debugging-legokid1503-388e44271604002577b10841934d5f2c3cc5df1e.zip | |
Next Step : Pseudocode
Diffstat (limited to 'CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp')
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp index 53830da..67e31b7 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp @@ -25,6 +25,7 @@ * your program to your Project. Execute your program again * 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. * 10) Fix all the problems in your code that exist in relation to * the output. Verify that your output is appropriate for your @@ -81,9 +82,9 @@ int main() ifstream inFile; // Notice how this automatically opens the file - ofstream outFile("C:\\TEMP\\Chap_11_Report.txt"); + ofstream outFile("Chap_11_dataoutput.txt"); - inFile.open("C:\\TEMP\\Chap_11_data.txt"); + inFile.open("Chap_11_data.txt"); if (inFile.is_open()) { @@ -98,13 +99,13 @@ int main() } else { - cout << "Trouble Opening File"; + cout << "Trouble Opening File OUT"; cout << "\n\n\t\t ** About to EXIT NOW! ** "; } } else { - cout << "Trouble Opening File"; + cout << "Trouble Opening File IN"; cout << "\n\n\t\t ** About to EXIT NOW! ** "; } return 0; @@ -128,7 +129,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) |