blob: a30a29b93ef541bdf5d982661bdf4537d8dc9571 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
1. declare constant int [EMPLOYEES] = 20 and [MAX] = 21
2. Create array for input file [inFile] and output file [outFile] to be read into with char [name] and int [age], let the code decide what size is appropriate
1. declare char [name] = [EMPLOYEES]
2. declare int [age]=[EMPLOYEES]
3. declare int [record_counter] = 0
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]
3. if [outFile] is open
1. run WriteOutputFile
2. run PrintTotalsAndSummary
3. close [outFile]
4. else
1. print "Trouble Opening the Chapter 11 Report File
2. print "** About to EXIT NOW! **"
7. else
1. print "Trouble Opening the Names File"
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"
|