#include #include #include // see this is live using namespace std; void OpenFiles(ifstream & highFile, ifstream & lowFile, bool & fileValid ); void ReadInNextData(bool & validData); void ProcessData(void); void PrintReport(void); void OpenFile(string fileName, ifstream & file, bool & valid); int main() { bool dataValid = false; bool fileValid = true; ifstream highPriceFile, lowPriceFile; OpenFiles(highPriceFile, lowPriceFile, fileValid); ReadInNextData(dataValid); while(dataValid) { ProcessData(); ReadInNextData(dataValid); } PrintReport(); return 0; } void OpenFile(string fileName, ifstream & file, bool & valid){ valid = false; file.open(fileName); if (file) { valid = true; } return; } void DebugOpen(string highFileName, bool fileValid){ if (fileValid) { cout << "opened " << highFileName << endl; } else { cout << "Could not open " << highFileName << endl; } } void OpenFiles(ifstream & highFile, ifstream & lowFile, bool & fileValid){ string highFileName, lowFileName; //GetFileNames(highFileName, lowFileName); highFileName = "file1.dat"; lowFileName = "file2.dat"; OpenFile(highFileName, highFile, fileValid); DebugOpen(highFileName, fileValid); OpenFile(lowFileName, lowFile, fileValid); DebugOpen(lowFileName, fileValid); return; } void ReadInNextData(bool & validData){ cout << "Reading the data " << endl; return; } void ProcessData(void){ cout << "Processing the data " << endl; return; } void PrintReport(void){ cout << "Final Report" << endl; return; }