diff options
| author | Trevor Bouchillon <[email protected]> | 2022-10-30 15:50:46 -0700 |
|---|---|---|
| committer | Trevor Bouchillon <[email protected]> | 2022-10-30 15:50:46 -0700 |
| commit | e51c2b33239a8fa4a2ebbad13cda3a789c1d97eb (patch) | |
| tree | 63b59298b4ce62ffc3c11c67d5729898061473fb | |
| parent | removed and re added backslashes (diff) | |
| download | cst116-ch11-debugging-daboochillin-e51c2b33239a8fa4a2ebbad13cda3a789c1d97eb.tar.xz cst116-ch11-debugging-daboochillin-e51c2b33239a8fa4a2ebbad13cda3a789c1d97eb.zip | |
Created variables for filenames
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp index a588228..5d802b0 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp @@ -63,6 +63,7 @@ using std::cout; using std::endl; using std::setw; using std::ios; +using std::string; using std::ifstream; using std::ofstream; @@ -70,6 +71,9 @@ using std::ofstream; const int EMPLOYEES = 20; const int MAX = 21; +string OutFileName = "C:\\TEMP\\Chap_11_ReportOut.txt"; +string InFileName = "C:\\TEMP\\Chap_11_Report.txt"; + int ReadData(ifstream& inFile, ofstream& outFile, char name[][MAX], int age[]); void WriteOutputFile(ofstream& outFile, char name[][MAX], int age[], int counter); @@ -84,9 +88,9 @@ int main() ifstream inFile; // Notice how this automatically opens the file - ofstream outFile("C:\\TEMP\\Chap_11_ReportOut.txt"); //changed output file to be seperate. + ofstream outFile(OutFileName); //changed output file to be seperate. - inFile.open("C:\\TEMP\\Chap_11_Report.txt"); + inFile.open(InFileName); if (inFile.is_open()) { @@ -101,13 +105,13 @@ int main() } else { - cout << "Trouble Opening File"; + cout << "Trouble Opening: " << OutFileName; cout << "\n\n\t\t ** About to EXIT NOW! ** "; } } else { - cout << "Trouble Opening File"; + cout << "Trouble Opening: " << InFileName; cout << "\n\n\t\t ** About to EXIT NOW! ** "; } return 0; |