blob: 52a6e73a39e0444f80424fb8128792d41adb02e9 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
Namespace std is declared
ifstream is declared
ofstream is declared
const max is set to 50;
Int ReadData is declared with the following: ifstream& inFile, ofstream& outFile, int pick array, int drop array, int psgr array
int dist array int fare array, float toll array
void WriteOutputFile is declared with the following: ofstream& outFile, int pick array, int drop array, int psgr array
int dist array int fare array, float toll array
int counter
void PrintTotalsAndSummary is declared with the following: ofstream& out, int totalRecords
Main Function is Declared
int record counter is set to zero
string nameFile is declared
ifstream infile is declared
ofstream is set to make a output file to a path
infile is set to open a file that has been inputed by the user.
Display Please Enter the file name with the file extension:
enter nameFile
if the file is successfully opened
record_counter is set to read the data and output it to the output file.
the input file would close.
end of if
if the output file is successfully opened
the data from the input file is written into the output file.
end of if
otherwise
Display Trouble Opening File
Display** About to EXIT NOW! **
otherwise
Display Trouble Opening File
Display** About to EXIT NOW! **
return zero
End of Main
ReadData Functon is declared
int counter is set to 0
inFile is getting ready to read.
while the file has not been read
Look for the following
name and age on each side
Trip Pass Dist Fare Toll TF CM
1 5 5.43 9.69 0 9.69 1.78
contiune counting until all data has been read.
end of while
return the counter
end of ReadData
WriteOutputFile is declared
Display "Here is the output file"
for loop (For each record that is less than or equal to counter record is counted)
Write each record in this format
Trip Pass Dist Fare Toll TF CM
1 5 5.43 9.69 0 9.69 1.78
End of For loop
End of WriteOutputFile
PrintTotalsAndSummary is declared
Display to the user
Total People Transported:
Total Paid:
Average Cost Per Person:
Display to the file
Total People Transported:
Total Paid:
Average Cost Per Person:
End of PrintTotalsAndSummary
End of Program.
|