CS 14 - Lab


CS 14 Homepage

First Task - Lab Practical

Complete the lab practical as assigned by the TAs. You will have 2 hours to complete the practical. You will turn in your lab using the electronic turnin. WATCH THE TIME! The electronic turnin will be gone 2 hours after the scheduled start time of your lab section and ASBOLUTELY NO LATE LAB PRACTICALS WILL BE ACCEPTED NO MATTER WHAT THE REASON EVEN IF YOU ARE ONLY 1 SECOND LATE. DO NOT TRUST THE CLOCK ON YOUR COMPUTER!!! IT IS NOT THE SAME AS THE CLOCK ON THE TURNIN SERVER. MAKE SURE YOU OPEN A TURNIN PAGE AND REFRESH IT IF YOU WOULD LIKE TO KNOW THE CURRENT TIME. REMEMBER THAT LAB PRACTICALS ARE 8% OF YOUR GRADE. DO NOT PUSH THE TURNIN TIME BECAUSE IF YOU MISS THE TURNIN, YOU ARE OUT OF LUCK. I suggest that you implement the functions in the order specified above and turn in a copy of your code each time you get a new function working so that you can maximize your points. You may not use ANY reference material at all and, should I even need to specify that this includes web, IM, chat, email, book, previous code written by you, code written by anyone, etc. You may not look at ANY reference while doing this lab practical. You may only look at this web page containing the lab practical, electrontic turnin, your code that you are currently writing for the practical, and gdb or ddd.

Second Task - Templatized Insertion Sort

For this lab you will be working alone. There is a lot to do during this lab section and if you do not finish during lab time, you may finish outside of lab. The lab is due 24 hours after your lab section ends. However, try to finish during your scheduled lab time and demo your program during lab.

You will be writing a templatized version of the insertion sort algorithm. You will then use your sorting function to sort arrays of ints, floats, chars, and a user defined class (obtainable here). The user defined class will consist of a first name and a last name string. Instances of the class will be sorted by last name and then by first name. You will need to overload one or more operators to accomplish the sorting of the class instances.

You will also need the print functions obtainable in print.cc. Please note that I could have used a template function instead of giving you 4 different instances of the print function, one for each type sorted. .25 extra credit points will be available for replacing the print function with a templatized print function and implementing any necessary overloaded functions to acheive this.

Note about template functions and g++

To comply with good coding style, you should assume that when creating your template functions, they should go in a separate file other that where your main function is in main.cc. However, due to the implementation of gcc/g++, template functions must appear in the file that has the function call to those functions. This is not the norm, just happens to be how gcc/g++ was implemented. You will find that different compilers will not have this problem. If you had a template class with template functions, those could all go in a header file. However, since you are just writing template functions, don't put them in a header file. Instead, you may put your templatized function(s) before the main function in my main.cc file. The TA will then have to visually check the main function to verify that you have not altered the functionality testing.

Point Breakdown For Lab Assignment

You may demo your program in lab or it will be graded from your electronic submission (due 24 hours after the end of your lab section). Please show the output from main.cc to the TA if you complete the lab. The TA will also look at your code for correctness when checking out. Remember, to receive credit for this lab, you MUST turn the code in online even if you have already demoed in lab If you do not turn in your code online, you will lose points for your lab. All code must be turned in online for archival purposes.

Remeber to compile your code using the flags "-g -Wall -W -Werror -pedantic". You must use a makefile.