summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorTaylor Rogers <[email protected]>2022-11-28 13:58:19 -0800
committerTaylor Rogers <[email protected]>2022-11-28 13:58:19 -0800
commit7baec85787550efe3b22218a618317763ff8a0b8 (patch)
tree1e897c52102060f0e50b91a2ad5f500595b79fd9 /BlankConsoleLab/BlankConsoleLab.cpp
parentadded name (diff)
downloadcst116-lab3-taylorrog-7baec85787550efe3b22218a618317763ff8a0b8.tar.xz
cst116-lab3-taylorrog-7baec85787550efe3b22218a618317763ff8a0b8.zip
Added output file headers
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index ad4a7ad..6e94674 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -6,6 +6,7 @@
#include <iostream>
#include <fstream>
#include <iomanip>
+#include <string>
using std::cout;
@@ -17,7 +18,7 @@ using std::ifstream;
using std::ofstream;
using std::string;
-const int MAX = 100;
+const int MAX = 50;
int ReadData(ifstream& inFile, int pick[], int drop[], int psgr[], float dist[], float fare[], float toll[]);
@@ -26,6 +27,8 @@ void WriteOutputFile(ofstream& outFile, int pick[], int drop[], int psgr[], floa
void PrintTotalsAndSummary(ofstream& out, int totalRecords);
+
+
int main()
{
@@ -36,12 +39,12 @@ int main()
float fare[MAX];
float toll[MAX];
int record_counter(0);
- string filename;
-
+
+ string fnameinput;
// Filename from user input
cout << "Enter the file name you wish to read data from: ";
- cin >> filename;
+ cin >> fnameinput;
cout << endl;
ifstream inFile;
@@ -49,7 +52,7 @@ int main()
// Notice how this automatically opens the file
ofstream outFile("lab3_Report.txt");
- inFile.open(filename);
+ inFile.open(fnameinput);
if (inFile.is_open())
{
@@ -105,6 +108,9 @@ void WriteOutputFile(ofstream& outFile, int pick[], int drop[], int psgr[], floa
int counter)
{
outFile << " Here is the Output File" << endl;
+ outFile << endl;
+ outFile << setw(5) << "Pickup" << setw(10) << "Dropoff" << setw(12) << "Passengers" << setw(14) << "Distance" << setw(14) << "Fare" << setw(14) << "Toll" << endl;
+
for (int r = 0; r <= counter - 1; r++)
{
outFile << setiosflags(ios::left)