diff options
Diffstat (limited to 'CST116-Ch11-Debugging')
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 11 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj | 4 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters | 8 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/Chap_11_data.txt | 12 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/Chap_11_dataoutput.txt | 17 |
5 files changed, 47 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) diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj index 2073e5b..1ac8fc2 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj @@ -129,6 +129,10 @@ <ItemGroup> <ClCompile Include="CST116-Ch11-Debugging.cpp" /> </ItemGroup> + <ItemGroup> + <Text Include="Chap_11_data.txt" /> + <Text Include="Chap_11_dataoutput.txt" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters index 2029dc7..a088b39 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters @@ -19,4 +19,12 @@ <Filter>Source Files</Filter> </ClCompile> </ItemGroup> + <ItemGroup> + <Text Include="Chap_11_data.txt"> + <Filter>Source Files</Filter> + </Text> + <Text Include="Chap_11_dataoutput.txt"> + <Filter>Source Files</Filter> + </Text> + </ItemGroup> </Project>
\ No newline at end of file diff --git a/CST116-Ch11-Debugging/Chap_11_data.txt b/CST116-Ch11-Debugging/Chap_11_data.txt new file mode 100644 index 0000000..b8c5ac2 --- /dev/null +++ b/CST116-Ch11-Debugging/Chap_11_data.txt @@ -0,0 +1,12 @@ +John 19 +Molly 23 +Tim 48 +Keil 42 +Trinh 21 +Anthony 25 +Kevin 27 +Cheryl 32 +Kim 16 +Dave 25 +Will 34 +TIMMY 37 diff --git a/CST116-Ch11-Debugging/Chap_11_dataoutput.txt b/CST116-Ch11-Debugging/Chap_11_dataoutput.txt new file mode 100644 index 0000000..6a8554e --- /dev/null +++ b/CST116-Ch11-Debugging/Chap_11_dataoutput.txt @@ -0,0 +1,17 @@ + Here is the Output File +John 19 +Molly 23 +Tim 48 +Keil 42 +Trinh 21 +Anthony 25 +Kevin 27 +Cheryl 32 +Kim 16 +Dave 25 +Will 34 +TIMMY 37 + + + ** Total Records: 12 ** + The End |