diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 16 |
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) |