summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index dbd583c..6c331be 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -143,12 +143,17 @@ void WriteOutputFile(ofstream& outFile, int pick[], int drop[], int psgr[], floa
void PrintTotalsAndSummary(ofstream& outFile, int totalRecords, int totalPassengers, float totalSum)
{
+ float avgcost = 0;
+ avgcost = totalSum / totalPassengers;
// To screen
cout << "Total Records: " << totalRecords << "." << endl;
cout << "Total Passengers: " << totalPassengers << "." << endl;
cout << "Total Cost: " << totalSum << "." << endl;
+ cout << "Average Cost: " << avgcost << "." << endl;
// To file
- outFile << "\n\n\t** Total Records: " << totalRecords << " **\n"
- << "\t\t The End \n";
+ outFile << "Total Records: " << totalRecords << "." << endl;
+ outFile << "Total Passengers: " << totalPassengers << "." << endl;
+ outFile << "Total Cost: " << totalSum << "." << endl;
+ outFile << "Average Cost: " << avgcost << "." << endl;
}