From 259696b7c05a83b0e02a0e624d48a9d7fd49578c Mon Sep 17 00:00:00 2001 From: Taylor Rogers Date: Wed, 2 Nov 2022 17:24:45 -0700 Subject: Finished pseudo-code --- .../CST116-Ch11-Debugging-Pseudo-Code-Rogers.txt | 25 ++++++++++++++++++++-- CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Pseudo-Code-Rogers.txt b/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Pseudo-Code-Rogers.txt index 41deeae..a30a29b 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Pseudo-Code-Rogers.txt +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Pseudo-Code-Rogers.txt @@ -3,8 +3,8 @@ 1. declare char [name] = [EMPLOYEES] 2. declare int [age]=[EMPLOYEES] 3. declare int [record_counter] = 0 - 4. declare ifstream [inFile] - 5. delcare ofstream [outFile] = C:\\Users\\taylo\\OneDrive\\OIT\\2022_Fall\\CST116\\Week_6\\bChap_11_Report.txt + 4. declare ifstream [inFile] = C:\\Users\\taylo\\OneDrive\\OIT\\2022_Fall\\CST116\\Week_6\\Names.txt + 5. delcare ofstream [outFile] = C:\\Users\\taylo\\OneDrive\\OIT\\2022_Fall\\CST116\\Week_6\\Chap_11_Report.txt 6. if [inFile] is open 1. set record_counter = ReadData 2. close [inFile] @@ -20,3 +20,24 @@ 2. print ** About to EXIT NOW! ** 3. Close the output file 4. Print the total and summary + +Functions: +ReadData: +1. Declare [counter] = 0 +2. Read the [name] and [age] from inFile and place into outFile with width formatting. +3. Assign each [name] and its associated [age] to a [counter] value + +WriteOutputFile: +1. Print "Here is the Output File" +2. Declare [r] = 0 +3. For + 1. [r] <= [counter], add one to [r] + 2. Add the name and age values associated with the [r] number to [outFile] with width formatting + +PrintTotalsAndSummary: +1. Declare int [totalRecords] (I'm not really seeing where totalRecords gets its value) +2. Print "** Total Records: [totalRecords] **" +3. Print "The End" +4. Write to [outFile] "** Total Records: [totalRecords] **" +5. Write to [outFile] "The End" + diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp index 36ee294..811b6ee 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp @@ -93,7 +93,7 @@ int main() ifstream inFile; // Notice how this automatically opens the file - ofstream outFile("C:\\Users\\taylo\\OneDrive\\OIT\\2022_Fall\\CST116\\Week_6\\bChap_11_Report.txt"); + ofstream outFile("C:\\Users\\taylo\\OneDrive\\OIT\\2022_Fall\\CST116\\Week_6\\Chap_11_Report.txt"); inFile.open("C:\\Users\\taylo\\OneDrive\\OIT\\2022_Fall\\CST116\\Week_6\\Names.txt"); -- cgit v1.2.3