summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei F <[email protected]>2022-11-01 22:58:55 -0700
committerAndrei F <[email protected]>2022-11-01 22:58:55 -0700
commit3e3314c0c72f0c7c06ccc51d1c2070f6ee9f4db9 (patch)
tree911164774fa80663a881812ed08179c248fc0efc
parentFinished part 2 (diff)
downloadcst116-ch11-debugging-florea-3e3314c0c72f0c7c06ccc51d1c2070f6ee9f4db9.tar.xz
cst116-ch11-debugging-florea-3e3314c0c72f0c7c06ccc51d1c2070f6ee9f4db9.zip
Finishing Chap11
-rw-r--r--CST116-Ch11-Debugging-Florea.txt15
-rw-r--r--CST116-Ch11-Debugging-Pseudo-Code-Florea.txt54
-rw-r--r--CST116-Ch11-Debugging/CST116-Ch11-Debugging-Florea.cpp (renamed from CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp)0
3 files changed, 69 insertions, 0 deletions
diff --git a/CST116-Ch11-Debugging-Florea.txt b/CST116-Ch11-Debugging-Florea.txt
new file mode 100644
index 0000000..0c8c059
--- /dev/null
+++ b/CST116-Ch11-Debugging-Florea.txt
@@ -0,0 +1,15 @@
+John 19
+Molly 23
+Tim 48
+Keil 42
+Trinh 21
+Anthony 25
+Kevin 27
+Cheryl 32
+Kim 16
+Dave 25
+Will 34
+
+
+ ** Total Records: 11 **
+ The End \ No newline at end of file
diff --git a/CST116-Ch11-Debugging-Pseudo-Code-Florea.txt b/CST116-Ch11-Debugging-Pseudo-Code-Florea.txt
new file mode 100644
index 0000000..3e147c3
--- /dev/null
+++ b/CST116-Ch11-Debugging-Pseudo-Code-Florea.txt
@@ -0,0 +1,54 @@
+init var EMPLOYEES as const integer, set it to 20
+init var MAX as const integer, set it to 21
+
+prototype func ReadData(inFile, Outfile, name[][MAX], age)
+prototype func WriteOutPutFile(outfile, name[][MAX], age[], counter)
+prototype func PrintTotalAndSummary(out, totalRecords)
+
+def func main
+ init var name as char as 2D array
+ init var age as int array
+ init var record_counter(0) as int
+
+ init var inFile as ifstream (reading a file)
+
+ init var ofstream as outFile (writing to file)
+
+ if inFile is open
+ record_counter = ReadData(inFile, outFile, name, age)
+ close inFile
+
+ if outFile is open
+ WriteOutPutFile(outFile, name, age, record_counter)
+ PrintTotalAndSummary(outFile, record_counter)
+ close outFile
+
+ else
+ display "Trouble opening output file"
+ display "About to exit NOW"
+
+ else
+ display "Trouble opening input file"
+ display "About to exit NOW"
+
+def func int ReadData(ifstream& inFile, ofstream& outFile,
+ char name[][MAX], int age[])
+ init var counter and set it to 0
+ prime reading of inFile
+
+ while line pointer not at the end of file of inFile
+ read the input
+ increase counter by 1
+ read the name[counter] and age[counter]
+
+ return counter
+
+def func void WriteOutPutFile(ofstream& outFile, char name[][MAX], int age[], int counter)
+ display "Here is the output file"
+
+ for (var r set to 0; r is less than counter; add 1 to r)
+ write input to outFile
+
+def func void PrintTotalAndSummary(ofstream& outFile, int totalRecords)
+ display "Total records" + totalRecords - to console screen
+ display "Total records" + totalRecords - to output file
diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Florea.cpp
index 5147bc6..5147bc6 100644
--- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp
+++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging-Florea.cpp