Source of testrem1.cpp


  1: // Filename: TESTREM1.CPP
  2: // Purpose:  Tests the Reminder class in REM1.H and REM1.CPP.  Reads
  3: //           reminders from the keyboard and displays them in another form.

  5: #include <iostream>
  6: using namespace std;

  8: #include "REM1.H"
  9: #include "PAUSE.H"


 12: int main()
 13: {
 14:     cout << "\nThis program reads in and re-displays "
 15:          << "\"reminders\" with associated dates. "
 16:          << "\n\nReminders input must have this (typical) form: "
 17:          << "\n20001225First Christmas of the millennium"
 18:          << "\n\nStudy the code and output simultaneously.\n\n";

 20:     cout << "First we display the \"default reminder\": \n";
 21:     Reminder someReminder;
 22:     someReminder.Display();
 23:     Pause(0);

 25:     typedef char String80[81];
 26:     int date;
 27:     String80 message;

 29:     cout << "Now we enter and re-display some further reminders: \n";
 30:     cout << "Enter first reminder (or end-of-file to quit): ";
 31:     cin >> date;
 32:     while (cin)
 33:     {
 34:         cin.getline(message, 80);
 35:         Reminder reminder(date, message);
 36:         reminder.Display();
 37:         cout << endl;
 38:         cout << "Enter next reminder (or end-of-file to quit): ";
 39:         cin >> date;
 40:     }

 42:     return 0;
 43: }