23.11 Programming Exercises

I l @ ve RuBoard

Exercise 23-1: Write a class that handles page formatting. It should contain the following functions:

open_file(char * name )

Opens the print file.

define_header(char *heading)

Defines heading text.

print_line(char *line)

Sends a line to the file.

page( )

Starts a new page.

close_file( )

Closes the print file.

Exercise 23-2: Write a module called search_open that receives an array of filenames, searches the array until it finds one that exists, and opens that file.

Exercise 23-3: Write a symbol table class containing the following functions:

void enter(const std::string& name)

Enters a name into the symbol table.

int lookup(const std::string& name)

Returns 1 if the name is in the table; returns 0 otherwise .

void remove(const std::string& name)

Removes a name from the symbol table.

Exercise 23-4: Take the words program from Chapter 20, and combine it with the infinite array module to create a cross-reference program. (As an added bonus, teach it about C++ comments and strings to create a C++ cross-referencer.)

I l @ ve RuBoard


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net