Leave all files in directory lab4 in your 2440 directory. Leave a readme file if you have special instructions for running your program.
Segmentation fault, or
Floating point exception. Those error messages are not overly helpful to you to identify what is wrong with your program. Fortunately, there is a tool to help is find where these problems are occurring - a debugger. Go through this gdb Overview to see how to use gdb.
node1.h and node1.Care provided for you and are located in the lab4 directory.
sequence3.h:The header file for the new sequence class. Actually, you don't have to write much of this file. Just start with our version and add your name and other information at the top. If some of your member functions are implemented as inline functions, then you may put those implementations in this file too. By the way, you might want to compare this header file with your first sequence header file (sequence1.h), and second sequence header file (sequence2.h). The linked list version no longer has a CAPACITY constant nor a DEFAULT_CAPACITY constant because the items are stored on a linked list instead of an array.
sequence3.C:The implementation file for the new sequence class. You will write all of this file, which will have the implementations of all the sequence's member functions.
sequence_test.C:This is the same interactive test program that you used with the earlier sequences. If you want to use it with the new sequence, then copy it to your directory and open it with your editor. Change the statement
sequence_ex3.C:A non-interactive test program that will be used to grade the correctness of your new sequence class.
makefileand then change the string
<TAB>to a real tab made by hitting the tab key. You will have to do this in two different places. Then when you want to compile, just say "make s_exam" or "make s_test". An example makefile is available in the lab4 directory. Here is what needs to go in your makefile:
s_exam: sequence3.h sequence3.C node1.h node1.C sequence_ex3.C <TAB>g++ -Wall sequence3.C sequence_ex3.C node1.C -o s_exam s_test: sequence3.h sequence3.C node1.h node1.C sequence_test.C <TAB>g++ -Wall sequence3.C sequence_test.C node1.C -o s_testNote: If you are using vim with the .vimrc supplied by Andy Dalton using
<TAB>will get you 4 spaces, not a tab character. The makefile requires the tab character. To disable the conversion of the tab character to 4 spaces, type:
:set noexpandtabbefore you start working on the makefile. Also note this change will only take effect in the current vim session. If you quit, and wish to make further modifications, you'll have to reset that variable.
See My Make Tutorial for more detailed information on make and makefiles.
Your sequence class for this assignment will differ from the your previous sequence in the following ways:
Start by declaring the new sequence's private member variables in sequence3.h. You might try declaring these variables yourself, and then compare your solution with the suggestion in Section 5.4.
Once again, do your work in small pieces. For example, my first version of the sequence had only a constructor, start, insert, advance, and current. My other member functions started out as stubs.
Use the interactive test program to track down errors in your implementation. If you have an error, do not start making changes until you have identified the cause of the error.