< previous page page_828 next page >

Page 828
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
strcpy(aName,  );
strcpy(aFriend.firstName, aName);
strcpy(aFriend.lastName, aName);
today.month = 1;
today.day = 1;
today.year = 1996;
aFriend.birthDate = today;
self = aFriend;
9. Declare a struct type named RecType to contain two integer variables and one Boolean variable. (Assume a Boolean type has already been defined.)
10. Using the declarations in this chapter of the MachineRec type and the inventory array, the code below is supposed to count the number of machines that have not been serviced within the current year. The code has an error. Correct the error by using a proper member selector in the If statement.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
DateType currentDate;
 .
 .
 .
machineCount = 0;
for (index = 0; index < NUM_MACHINES; index++)
    if (currentDate.year != lastServiced.year)
       machineCount++;
11. Given the declarations
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
typedef char String20[21];
typedef char String2[3];

struct NameType
{
    String20 first;
    String20 last;
};
struct PlaceType
{

    String20 city;
    String2  state;
    long     zipCode;
};
struct PersonType
{
    NameType name;
    PlaceType place;
};

PersonType person;
write C++ code that stores information about yourself into person.

 
< previous page page_828 next page >