1: // Filename: TESTDATE.CPP 2: // Purpose: Tests the date class in date?.h and date?.cpp (? == 1 or 2). 3: // Uses a data file whose name must be entered by the user. 5: #include <iostream> 6: #include <fstream> 7: #include "pause_cpp" 8: #include "date_cpp" 10: typedef char String80[81]; 13: void DisplayReminders(istream& reminderFile) 14: // Pre: "reminderFile" exists, contains valid data, and is open. 15: // Post: All data in "reminderFile" has been displayed. 16: { 17: int year, month, day; 18: String80 message; 20: reminderFile >> year >> month >> day; 21: while (reminderFile) 22: { 23: reminderFile.getline(message, 80); 24: Date d(month, day, year, message); 25: d.Display(); 26: cout << endl; 27: reminderFile >> year >> month >> day; 28: } 29: } 32: int main() 33: { 34: cout << endl; 36: String80 fileName; 37: cout << "Enter name of current reminder file: "; 38: cin >> fileName; cin.ignore(80, '\n'); cout << endl; 39: cout << endl; 41: ifstream reminderFile(fileName); 42: DisplayReminders(reminderFile); 43: reminderFile.close(); 45: return 0; 46: }