CSCI 160 Switch Lab

CSCI 160: Fall 2021 Switch Lab (October 8, 2021)

In software development, we often want to test out various options in the software that we develop; hence the "testapp" program, which we create as a means to testing the functionality of a module we may have created.

For this lab, we're going to write the testapp for a new data structure that we haven't written yet. The data structure operates like a <\bf set> and allows the calling program to do the following operations: initialize a new, empty set; to insert an integer ("int") data point; remove an integer data point; ask if a certain data point is in the set; list all the contents of the set; or to exit.

You are to write the "main" program (i.e., with a "int main()" function in it) that calls the functions that are in set.hpp and allows the user to test them. You will have to link to the file set.o, which has an implementation of the Set operations in it.

Your program should:

You can copy the set functions implementation by using the following command, if you are in your top directory, and you have a directory called 160, and in 160 you have the directory called switch.
cp ~gpruesse/Public/160/set.o 160/switch/.
cp ~gpruesse/Public/160/set.hpp 160/switch/.

Now you can write your set tester program; call it setTester.cpp.
Then you can compile it with the following command:

g++ -c setTester.cpp

Then you can link it to set.o with the following command:
g++ -o setTest setTester.o set.o
Now test set. There is a problem with the implementation. When you have found it, tell your instructor. Then get a new set module from the instructor's directory, and test it.


Useful Links: Gara Pruesse's Homepage
Computing Science Homepage
Vancouver Island University Homepage
X2Go