This project incorporates several exercises from the Nagler text [shown in brackets below]. You should read that text through chapter 7 to learn the required techniques. To the extent that instructions here differ from the text, these instructions take precedence. Copies of all necessary files are also in |
swapper.cpp
by writing the following parts:
swapByPointer
and
swapByReference
.
main
. Use it as is to test your functions.
finder.cpp
by writing the
(a) forward declaration and (b) definition for the find
function used by
main
. Do not change main
.
array.cpp
by writing the
(a) forward declarations and (b) definitions for the four functions described in the
text, with just one exception:
allocate
to skip the part about letting the user specify
row and column values (main
does that part and passes the
values to allocate
).
main
. Be sure the output exactly matches the output of the executable
program, ~cs60/hw4/executables/array
.
That program expects the user to repeatedly enter row and column
values to standard input, and end the input with a ctrl-D
.
Int
and
Complex
, described in the exercise.
int.h
- interface for class Int
. The
public interface must include default, converting, and copy constructors; a destructor; and
an accessor for the integer value. Also declare the non-member function to add two Int
s.
int.cpp
- implement all functions declared in
int.h
. Test your implementation at this time, but do not
turn in any test programs that you write.
complex.h
- interface for class Complex
.
The public interface must include default, converting, complete (2-argument), and copy constructors;
a destructor; accessors for each Int
value; and a display function.
Declare the non-member function to add two Complex
es.
complex.cpp
- implement all of the functions
declared in complex.h
.
testcomplex.cpp
to test your implementation.
Results must match our solution's results (see link at top of this page).
swapper.cpp finder.cpp array.cpp int.h int.cpp complex.h complex.cpp
.cpp
or
.h
files. Then type:
turnin hw4@cs60 *.cpp *.h