Computer Science 235

CS 235 Projects


Note: Projects are to be completed by each student individually (not by groups of students).

Assignment Due Date
Project 1 5 Jul 2017
Project 2 12 Jul 2017
Project 3 19 Jul 2017
Project 5 26 Jul 2017
Project 6 2 Aug 2017
Project 7 9 Aug 2017

Submitting Project Files

Submit all .h and .cpp files needed to build the project. All files must have either a .h or .cpp extension. Any file with a .h extension must be 'included' in a file with a .cpp extension.

Package your source files (.h files and .cpp files) into a 'zip' archive. Do not use any folders. All files must be in a single 'zip' file with no folders. For example, on linux you could use a command like this:

$ zip lab1.zip *.h *.cpp

Submit your 'zip' file using Learning Suite.

Go to room 1058 TMCB.

Ask a CS 235 TA to download and grade your code.


g++ compiler

You may use a number of tools to create your code for the lab projects in this class such as Visual Studio or XCode. When you want to pass off your project your code needs to compile and run using the g++ compiler on Linux. We compile your code on Linux with a command similar to this:

$ g++ -Wall -Werror -g -std=c++14 *.cpp -o lab1

The 'c++14' option enables the new C++14 features. Note that the g++ compiler does not support all the C++14 features at this time.


Code Quality

The code you submit for projects will be evaluated for quality. We will measure the cyclomatic complexity of the code. If any function has a complexity measure greater than 8, the code will not pass.

We use the 'pmccabe' tool to measure code complexity. Pmccabe is available on the Linux machines in the CS labs. You can run pmccabe on your own code like this:

$ pmccabe *.h *.cpp

The output from pmccabe looks like this:

2	2	7	12	21	demo4.cpp(13): reverse
2	2	19	35	30	demo4.cpp(35): main

Pmccabe computes a number of values for each function in the code. The first value listed is the cyclomatic complexity for the function. The complexity for both functions in this code is 2. If pmccabe gives a value greater than 8 for the complexity of any function in the code, the code will not pass.

If your code fails because a function has high complexity, you can correct the problem by decomposing the high complexity function into smaller functions.


Command Line

Your program will be run with the names of the input and output files given on the command line. For example, your program could be run like this:

$ ./lab1 in10a.txt in10b.txt in10c.txt out10.txt

Your program needs to read its input from the given input files and write its output to the given output file.


Write-Protected Files

The input files given to your program will be write-protected. Your program will need to open input files only for reading, not for both reading and writing. If you attempt to open a write-protected input file for both reading and writing the open will fail.

For the C++ language, this means you need to use 'ifstream' to read input files (and not use 'fstream').


valgrind

Valgrind is a tool that will find memory access problems in your code. You should run valgrind on your code while you are creating it. Valgrind will help you avoid common coding errors and help you save debugging time. Valgrind is available on the Linux machines in the CS labs. You run valgrind on the executable program like this:

$ valgrind --leak-check=full ./lab1 in10a.txt in10b.txt in10c.txt out10.txt

When using valgrind you should compile the code with the -g option. This allows valgrind to give better information about the location of memory access problems in the code.

Valgrind will be run on your code when you pass-off a project. If valgrind reports any problems with your code your project will not pass.


Project Testing

The project testing page provides instructions for testing your project.


Program Exit Status

Your program must run to completion with a normal exit status for any input. Do not terminate with a non-zero exit status for any input, including inputs that have errors.

For the C++ language, this means that the 'main' function needs to return a value of zero and cannot return any non-zero value.


dos2unix

If you copy files from Windows to Linux you may need to convert the type of line termination used in the files. You can do this with the 'dos2unix' command on a Linux machine:

$ dos2unix *.*