summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Pearse <[email protected]>2022-11-02 17:16:14 -0700
committerTim Pearse <[email protected]>2022-11-02 17:16:14 -0700
commit388e44271604002577b10841934d5f2c3cc5df1e (patch)
tree0ba06e3587db28d2f6435f90d117dc96411c4c28
parentInitial commit (diff)
downloadcst116-ch11-debugging-legokid1503-master.tar.xz
cst116-ch11-debugging-legokid1503-master.zip
Change 1 : The Code is done?HEADmaster
Next Step : Pseudocode
-rw-r--r--CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp11
-rw-r--r--CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj4
-rw-r--r--CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters8
-rw-r--r--CST116-Ch11-Debugging/Chap_11_data.txt (renamed from Chap_11_data.txt)23
-rw-r--r--CST116-Ch11-Debugging/Chap_11_dataoutput.txt17
5 files changed, 47 insertions, 16 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/Chap_11_data.txt b/CST116-Ch11-Debugging/Chap_11_data.txt
index e4083f4..b8c5ac2 100644
--- a/Chap_11_data.txt
+++ b/CST116-Ch11-Debugging/Chap_11_data.txt
@@ -1,11 +1,12 @@
-John 19
-Molly 23
-Tim 48
-Keil 42
-Trinh 21
-Anthony 25
-Kevin 27
-Cheryl 32
-Kim 16
-Dave 25
-Will 34
+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