diff options
| author | Trevor Bouchillon <[email protected]> | 2022-11-29 19:26:35 -0800 |
|---|---|---|
| committer | Trevor Bouchillon <[email protected]> | 2022-11-29 19:26:35 -0800 |
| commit | e47b80a92ecb9dbf9ffc084a31a079c04ee3808e (patch) | |
| tree | aa8ab975ebf89a319be2538793d5feb96096de01 /BlankConsoleLab/BlankConsoleLab.cpp | |
| parent | math for totalfare and cost per mile added (diff) | |
| download | cst116-lab3-daboochillin-e47b80a92ecb9dbf9ffc084a31a079c04ee3808e.tar.xz cst116-lab3-daboochillin-e47b80a92ecb9dbf9ffc084a31a079c04ee3808e.zip | |
Added total number of pass to outfile
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 772a55a..7698d7a 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -94,6 +94,7 @@ int ReadData(ifstream& inFile, int pick[], int drop[], int psgr[], float dist[], void WriteOutputFile(ofstream& outFile, int pick[], int drop[], int psgr[], float dist[], float fare[], float toll[], int counter, float TotalFare[], float CostPerMile[]) { + int sum = 0; outFile << " Here is the Output File" << endl; for (int r = 0; r <= counter - 1; r++) { @@ -102,16 +103,19 @@ void WriteOutputFile(ofstream& outFile, int pick[], int drop[], int psgr[], floa if (dist[r] == 0) { CostPerMile[r] = 0; } + sum = sum + psgr[r]; outFile << setiosflags(ios::left) << left << setw(10) << pick[r] << resetiosflags(ios::left) << left << setw(10) << drop[r] << resetiosflags(ios::left) << left << setw(10) << psgr[r] << resetiosflags(ios::left) << left << setw(14) << dist[r] << resetiosflags(ios::left) << left << setw(10) << fare[r] << resetiosflags(ios::left) << left << setw(10) << toll[r] << resetiosflags(ios::left) << left << setw(14) << TotalFare[r] << resetiosflags(ios::left) << left << setw(14) << setprecision(3) << CostPerMile[r] << endl; } + outFile << endl << endl << "Total # of Passengers: " << sum; } void PrintTotalsAndSummary(ofstream& outFile, int totalRecords) { // To screen cout << "\n\n\t** Total Records: " << totalRecords << " **\n" << "\t\t The End \n"; + // To file outFile << "\n\n\t** Total Records: " << totalRecords << " **\n" << "\t\t The End \n"; } |