CSCI 333 Project 4

This assignment is due Friday, 14 November, 2003 at 11:00 am.

The task

This project is an extension of Project 3. Your program will read the input file, as specified in the Project 3 description, and perform the specified initialization and increments and then output the variables and their "values" twice -- once sorted by variable name and once sorted by value.

When invoked your program will receive a single command line argument which we'll call fileprefix for this example. Your program will read its input file from fileprefix.input and write its output file sorted by name to to fileprefix.sortn and its output file sorted by value to to fileprefix.sortv.

For example, suppose your program is invoked with the command:

If the file testfile.input contains the following lines:

   abcd   =  15
 abcd   +=  13
 abcde  = 400

Then your program should write an output file testfile.sortv containing:

abcd     =      28
abcde    =     400
sogood   =    1799

If should also write an output file testfile.sortn containing:

sogood   =    1799
abcde    =     400
abcd     =      28

Two more requirements

Your program should not place any limits on the number of input variables it can process. In other words, it should use something like a linked list to store the input variables.

Your program should use an efficient algorithm for its sort. You can use the sorting algorithms of the textbook or you can use C's builtin qsort routine if you wish.

Turning in the assignment

Start by making a read-protected csci/333/Project4.

It is unlikely, or at least unadviseable, to write this program in a single file. This time you can use file names of your choice, but you must use a Makefile so that the program executable will be stored in Project 4. Here is an example Makefile used to grade Project 1. In this case, the executable was stored in TestHome1. Those intendented lines really must start with tabs.

all:		TestHome1

TestHome1:	TestHome1.o SillyExer.o
	g++ -o TestHome1 -g TestHome1.o SillyExer.o

TestHome1.o:	TestHome1.cpp SillyExer.h PolyLinkT.h
	g++ -c -g TestHome1.cpp

SillyExer.o:	SillyExer.cpp SillyExer.h PolyLinkT.h
	g++ -c -g SillyExer.cpp

	rm -rf *.o TestHome1