|
|
|
|
|
|
|
Below is the BirthdayCalls program that implements our design. By using the preexisting DateType class, the program is significantly shorter and easier to understand than if it included all the code to manipulate dates. All we have to do is #include the header file datetype.h to make use of DateType class objects. To run the program, we link its object code file with the DateType object code file, the place where all the DateType implementation details are hidden. |
|
|
|
|
|
|
|
|
//******************************************************************
// BirthdayCalls program
// A data file contains people's names, phone numbers, and birth
// dates. This program reads a date from standard input, calculates
// a date two weeks away, and prints the names, phone numbers, and
// birthdays of all those in the file whose birthdays come on or
// before the date two weeks away
//******************************************************************
#include datetype.h
#include <iostream.h>
#include <fstream.h> // For file I/O
typedef char String8[9]; // Room for 8 characters plus \0
typedef char String15[16]; // Room for 15 characters plus \0
struct PhoneType
{
int areaCode;
String8 number;
};
struct EntryType
{
String15 firstName;
String15 lastName;
|
|
|
|
|
|