summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Traver <[email protected]>2022-11-26 20:40:48 -0800
committerJoe Traver <[email protected]>2022-11-26 20:40:48 -0800
commit1b2d352f3c672cb5eb8158c2347f6824ff216c97 (patch)
treebf29921b387039eb289a93f3d15e3e9f7b5730a3
parentPrint data function (diff)
downloadcst116-lab3-joetraver30-1b2d352f3c672cb5eb8158c2347f6824ff216c97.tar.xz
cst116-lab3-joetraver30-1b2d352f3c672cb5eb8158c2347f6824ff216c97.zip
Main
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp48
-rw-r--r--BlankConsoleLab/Pseudocode.txt4
2 files changed, 46 insertions, 6 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index c5a2a56..b8844eb 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -3,8 +3,8 @@
#include <iostream>
-#include <fstream> // For the files!!!!
-#include <iomanip> // For manipulators & formatting options
+#include <fstream>
+#include <iomanip>
using std::cin;
using std::cout;
using std::endl;
@@ -25,6 +25,46 @@ void PrintTotalsAndSummary(ofstream& out, int totalRecords);
int main()
{
+ int pick[MAX];
+ int drop[MAX];
+ int psgr[MAX];
+ float dist[MAX];
+ float fare[MAX];
+ float toll[MAX];
+ float tfare[MAX];
+ int record_counter(0);
+
+ ifstream inFile;
+
+ ofstream outFile("C:\\TEMP\\lab3_report.txt");
+
+ inFile.open("C:\\TEMP\\lab3_data.txt");
+
+ if (inFile.is_open())
+ {
+ record_counter = ReadData(inFile, pick, drop, psgr, dist, fare, toll, tfare);
+ inFile.close();
+
+ if (outFile.is_open())
+ {
+ WriteOutputFile(outFile, pick, drop, psgr, dist, fare, toll, record_counter);
+ PrintTotalsAndSummary(outFile, record_counter);
+ outFile.close();
+ }
+ else
+ {
+ cout << "Trouble Opening File";
+ cout << "\n\n\t\t ** About to EXIT NOW! ** ";
+ }
+
+ }
+ else
+ {
+ cout << "Trouble Opening File";
+ cout << "\n\n\t\t ** About to EXIT NOW! ** ";
+ }
+ return 0;
+
}
int ReadData(ifstream& inFile, int pick[], int drop[], int psgr[], float dist[], float fare[], float toll[], float tfare[])
@@ -71,11 +111,11 @@ void WriteOutputFile(ofstream& outFile, int pick[], int drop[], int psgr[], floa
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";
}
diff --git a/BlankConsoleLab/Pseudocode.txt b/BlankConsoleLab/Pseudocode.txt
index 8341907..20c821d 100644
--- a/BlankConsoleLab/Pseudocode.txt
+++ b/BlankConsoleLab/Pseudocode.txt
@@ -10,7 +10,7 @@ Functions-
TotalPaid
AvgCostPerPerson
WriteOutputFile
- PrintCalculatedData
+ PrintTotalsandSummery
Variables-
@@ -100,7 +100,7 @@ WriteOutputData-
fare [counter]
toll [counter]
-PrintCalculatedData-
+PrintTotalsandSummery-
variables-
total_records