#include "testerResult.h" #include #include #include using namespace std; void readTextFile(ifstream &rif, int m, int d, int y) { string line; string filename; cout << "Enter filename : "; cin >> filename; cout << endl; rif.open(filename.c_str(),ios::in,ios::binary); Date date1; if(rif.fail()) { cout << "Cannot open file."; exit(1); } else { string stringMonth; while(rif >> stringMonth >> d >> y) { m = Date::convertMonthStringToInt(stringMonth); date1.setDate(m,d,y); if(date1.isValidDate(m,d,y) == true) { cout << endl; date1.displayDate(); cout << " is a valid date." << endl; cout << "This date is day number "; if((date1.isLeapYear() == true) && (m >= 3 || m <= 12)) { cout << date1.dayNumber() + 1; } else { cout << date1.dayNumber(); } cout << " of the year." << endl; if(date1.isLeapYear() == true) { cout << "This is a leap year." << endl; } else { cout << "This is not a leap year." << endl; } date1.increment(); cout << "The date after incrementing is: "; date1.displayDate(); cout << endl; } } while(rif >> m >> d >> y) { date1.setDate(m,d,y); if(date1.isValidDate(m,d,y) == true) { cout << endl; date1.displayDate(); cout << " is a valid date." << endl; cout << "This date is day number "; if((date1.isLeapYear() == true) && (m >= 3 || m <= 12)) { cout << date1.dayNumber() + 1; } else { cout << date1.dayNumber(); } cout << " of the year." << endl; if(date1.isLeapYear() == true) { cout << "This is a leap year." << endl; } else { cout << "This is not a leap year." << endl; } date1.increment(); cout << "The date after incrementing is: "; date1.displayDate(); cout << endl; } } if(date1.isValidDate(m,d,y) == false) { cout << endl; cout << date1.convertMonthNumberToString() << " " << d << ", " << y; cout << " is an invalid date." << endl; } cout << endl; } } int main() { ifstream rif; int m = 0; int d = 0; int y = 0; readTextFile(rif, m, d, y); return 0; }