From 8394a57a5aa1612663d8245d8bd7fbc7f3b093d5 Mon Sep 17 00:00:00 2001 From: alexandra-apetroaei Date: Wed, 2 Nov 2022 22:15:53 -0800 Subject: change --- CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 9 ++++++--- CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj | 3 +-- CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters | 3 +-- TEMP/John_19.txt | 11 +++++++++++ TEMP/names.txt | 11 +++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 TEMP/John_19.txt create mode 100644 TEMP/names.txt diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp index a0295db..ffbcaa4 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp @@ -68,8 +68,10 @@ const int EMPLOYEES = 20; const int MAX = 21; int ReadData(ifstream& inFile, ofstream& outFile, char name[][MAX], int age[]); + void WriteOutputFile(ofstream& outFile, char name[][MAX], int age[], int counter); + void PrintTotalsAndSummary(ofstream& out, int totalRecords); int main() @@ -78,12 +80,13 @@ int main() int age[EMPLOYEES]; int record_counter(0); - ifstream inFile("C:\\TEMP\\Chap_11_Report.txt"); + ifstream inFile; // Notice how this automatically opens the file - ofstream outFile; + ofstream outFile("C:\\TEMP\\names.txt"); + + inFile.open("C:\\TEMP\\names.txt"); - inFile.open("C:\\TEMP\\Chap_11_data.txt"); if (inFile.is_open()) { diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj index 05b57a1..0cbd5a6 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj @@ -130,8 +130,7 @@ - - + diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters index d1bbc46..43b6186 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.vcxproj.filters @@ -20,7 +20,6 @@ - - + \ No newline at end of file diff --git a/TEMP/John_19.txt b/TEMP/John_19.txt new file mode 100644 index 0000000..5f0b188 --- /dev/null +++ b/TEMP/John_19.txt @@ -0,0 +1,11 @@ +John 19 +Molly 23 +Tim 48 +Keil 42 +Trinh 21 +Anthony 25 +Kevin 27 +Cheryl 32 +Kim 16 +Dave 25 +Will 34 \ No newline at end of file diff --git a/TEMP/names.txt b/TEMP/names.txt new file mode 100644 index 0000000..f727fb1 --- /dev/null +++ b/TEMP/names.txt @@ -0,0 +1,11 @@ +John 19 +Molly 23 +Tim 48 +Keil 42 +Trinh 21 +Anthony 25 +Kevin 27 +Cheryl 32 +Kim 16 +Dave 25 +Will 34 -- cgit v1.2.3