CSCI 201 Fall 2000
Assignment 4
Program 1: Assignment 1 revisited
Recall that in assignment 1, you were
asked to write a program to output excerpts from a book by Marten and
Carle. In that assignment, you were asked to use at least one
function (other than main) to generate that output. To demonstrate
the power of reference variables, we will redo the program described
in assignment 1 and implement a more efficient solution. The improved
solution will be a program that consists of at least three functions:
(1) one or more functions to prompt the user for input and to read the
input that the user enters, (2) one or more functions to generate the
output, and (3) the main function where execution starts and from
which you call one or more of the other functions. By using reference
variables, you should be able to write a program that is shorted and
better organized that your original program for assignment 1.
The improved version of the sight program should be called
newSight.cpp. The program newSight.cpp must be turned in by
transferring it to your ftp directory for this class. Only the
source code file should be turned in and it must be named
newSight.cpp.
Program 2: Work assignment number 6.36 on page 265 of the text
and then write a program that calls the intersect function that you
wrote for that exercise.
Write the intersect function described in problem 6.36 of
your text and then write a program called myStringSet.cpp to
exercise that function. To use the string set class you will need two
.cpp files and two .h files:
stringset.cpp, stringset.h, tvector.txt, and
tvector.h. All of these files must be included in the project
folder for your program. Feel free to look at the .cpp files but
remember that you don't need to understand the implementation of a
class in order to use that class.
The values of the two string sets used to test your intersect
function should be read from files. Specifically, one string set
should be read from stringFile1.txt,
and the other from stringFile2.txt.
Add both of these text files to the project folder for this program.
You are free to use the WordStreamIterator class (as demonstrated in
Program 6.16 on page 264 of your text) if you would like, but you are
not required to do so. To use this class, include the files worditer.h and
worditer.cpp in your project folder for this program.
The program MyStringSet.cpp must be turned in by transferring it to your
ftp directory for this class. Only the source code file should be
turned in and it must be named MyStringSet.cpp.
Programming Style
Note that 10% of your program grade is based on the readability of
your program. This includes things like style, comments, and the
naming of variables and functions. Make sure you include a comment at
the top of each program with your name, course and purpose of the
program specified.
// Name: YOUR NAME HERE
//
// Course: CSCI 201
//
// Purpose: purpose of program here
//
Submitting Programs
As stated above, the programs written for
this assignment must be turned in by transferring the C++ source code
files to your ftp directory for this class. Only the source code
files (i.e., newSight.cpp and MyStringSet.cpp) should be turned in.
You were shown how to transfer files to your class ftp directory in lab01, here is a
quick repeat.