summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobdw22 <[email protected]>2022-11-28 14:52:50 -0800
committerjacobdw22 <[email protected]>2022-11-28 14:52:50 -0800
commit5a98a6de03cb61036067b54db5a994086291e5f3 (patch)
treea056044e0c590c2daf90b09b1b467b0c3a3b8ee0
parentRe-Added Outfile and large.txt (diff)
downloadcst116-lab3-jacobdw22-5a98a6de03cb61036067b54db5a994086291e5f3.tar.xz
cst116-lab3-jacobdw22-5a98a6de03cb61036067b54db5a994086291e5f3.zip
Code now reads in large.txt or small.txt based on users choice.
-rw-r--r--BlankConsoleLab/cst116-lab3-wilson.cpp25
-rw-r--r--BlankConsoleLab/lab3_Report.txt11
2 files changed, 24 insertions, 12 deletions
diff --git a/BlankConsoleLab/cst116-lab3-wilson.cpp b/BlankConsoleLab/cst116-lab3-wilson.cpp
index 5e8e066..a7630b0 100644
--- a/BlankConsoleLab/cst116-lab3-wilson.cpp
+++ b/BlankConsoleLab/cst116-lab3-wilson.cpp
@@ -40,23 +40,24 @@ int main()
// Notice how this automatically opens the file
- ofstream outFile("lab3_Report.txt");
+ ofstream outFile;
+ outFile.open("C:\\TEMP1\\lab3_Report.txt");
char file = 'a';
cout << "Please choose a file to open. Press 's' for small.txt, or press 'l' for large.txt: ";
cin >> file;
cout << endl;
- while (file != 's' && file != 'l'){
- switch (file) {
- case 's':
- inFile.open("small.txt");
- break;
- case 'l':
- inFile.open("large.txt");
- break;
- }
+ switch (file) {
+ case 's':
+ inFile.open("C:\\TEMP1\\small.txt");
+ break;
+ case 'l':
+ inFile.open("C:\\TEMP1\\large.txt");
+ break;
}
+ //inFile.open("C:\\TEMP1\\small.txt");
+
if (inFile.is_open())
{
record_counter = ReadData(inFile, outFile, pick, drop, psgr, dist,
@@ -71,13 +72,13 @@ int main()
}
else
{
- cout << "Trouble Opening Input File";
+ cout << "Trouble Opening Output File";
cout << "\n\n\t\t ** About to EXIT NOW! ** ";
}
}
else
{
- cout << "Trouble Opening Output File";
+ cout << "Trouble Opening Input File";
cout << "\n\n\t\t ** About to EXIT NOW! ** ";
}
return 0;
diff --git a/BlankConsoleLab/lab3_Report.txt b/BlankConsoleLab/lab3_Report.txt
index e69de29..1b24b39 100644
--- a/BlankConsoleLab/lab3_Report.txt
+++ b/BlankConsoleLab/lab3_Report.txt
@@ -0,0 +1,11 @@
+ Here is the Output File
+129 7 3 1.3 7.5 0
+36 69 1 11.41 32 5.76
+7 41 1 4.6 15 5.76
+150 61 2 6.75 23 0
+112 17 1 3.84 15 0
+80 112 6 1.64 9.5 0
+
+
+ ** Total Records: 6 **
+ The End