1: // Filename: TESTREM2.CPP
2: // Purpose: Tests the Reminder class in REM2.H and REM2.CPP.
3: // Uses a data file whose name must be entered by the user.
5: #include <iostream>
6: #include <fstream>
7: using namespace std;
9: #include "REM2.H"
11: int main()
12: {
13: typedef char String80[81];
14: String80 fileName;
16: cout << "\nThis program reads reminders from a "
17: << "file and displays them on the screen. "
18: << "\n\nReminders input must have this (typical) form: "
19: << "\n20001225First Christmas of the millennium"
20: << "\n\nStudy the code and output simultaneously.\n\n";
22: cout << "Enter name of current reminder file: ";
23: cin >> fileName; cin.ignore(80, '\n'); cout << endl;
24: cout << endl;
26: ifstream reminderFile(fileName);
27: int date;
28: String80 message;
30: reminderFile >> date;
31: while (reminderFile)
32: {
33: reminderFile.getline(message, 80);
34: Reminder r(date, message);
35: r.Display();
36: cout << endl;
37: reminderFile >> date;
38: }
39: reminderFile.close();
41: return 0;
42: }