< previous page page_830 next page >

Page 830
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
e. Compare aMap.chart and aRef for equality. Show which elements (if any) are not equal by outputting the indices for the appropriate token members and/or symbol members. For example, if the second element of the token members of both structs were not equal, you would output 1, and so on, for the remaining nonequal elements.
6. You are designing an automated library catalog system. The library contains 50,000 books. For each book, there is a catalog entry consisting of the call number (up to 10 characters), the number of copies in the library (an integer), the author (up to 30 characters), the title (up to 100 characters), and a description of the contents (up to 300 characters).
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. Write the type declarations necessary to represent this information.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. Estimate how many characters of memory space are required to hold all the catalog information for the library. (Assume that an integer value occupies the equivalent of four characters in memory.)
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. How many book records can a computer with 650,000 characters of memory hold?
7. Write a function that reads the information for a book into a struct of the type defined in Exercise 6. Write another function that prints the information contained in a struct of the type defined in Exercise 6. The struct should be passed as a parameter to each of these functions.
8. You are writing the subscription renewal system for a magazine. For each subscriber, the system is to keep the following information:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Name (first, last)
Address (street, city, state, zip code)
Expiration date (month, year)
Date renewal notice was sent (month, day, year)
Number of renewal notices sent so far
Number of years for which subscription is being renewed (0 for renewal not yet received; otherwise, 1, 2, or 3 years)
Whether or not the subscriber's name may be included in a mailing list for sale to other companies
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Write a hierarchical record type declaration to represent this information. Each subrecord should be declared separately as a named data type.
9. You are writing a program that keeps track of the terminals connected to a company computer. The computer may have up to 30 terminals connected to it. For each terminal, the following information must be kept:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Brand and model (a string of up to 15 characters)
Data rate (an integer representing 10 through 19,200 characters per second)
Parity (an enumeration type representing Even, Odd, One, Zero, or None)
Echoplex (an enumeration type representing Half or Full)
Data bits (an integer representing 7 or 8)
Stop bits (an integer representing 1 or 2)
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Design a data structure for this problem, and write the type declarations for all the data types that are needed to implement your design.
10. Write a struct declaration to contain a string of no more than 20 characters and the length of the string. Then write a value-returning function that returns the length of a string stored in this struct.

 
< previous page page_830 next page >