Overview: There are two .cpp file distributed with this project, rand.cpp and sorting.cpp. In the former case (rand.cpp), the code compiles into a utility that can be used to generate test cases for use with the sorting program. In the latter case, (sorting.cpp), the code provides a framework for the implemention of the sorting algorithms required by the homework assignment. Compilation: This code has been shown to compile using g++ 3.2.3 on Windows XP Professional SP2, and should compile equally well on Linux using the same (or newer) version of g++. It should also compile in MS Visual Studio, but this has not been tested or verified. When using g++, the invocation is "g++ rand.cpp" (for the number generation utility), and "g++ sorting.cpp" (for the sorting program). Also note that you will probably want to specify a different output name than the default a.out/a.exe by using the -o flag with g++. Usage: In its current state, the code requires very little user-interaction. If compiled with the above command, either program may then be run by typing "a.exe" (on Windows), or "./a.out" (on Linux). Note that for the random number program, you are required to specify the number of random numbers you want to generate as a command line argument. You will then see some information about the generation process and the program will terminate. The sorting program currently requires no user-interaction at all. Once invoked, it will print some status messages and then terminate. See the "Example Runs" section for specific examples of how to run both programs. Note that both programs should be run in the same directory. Specifications: The "rand" program is fairly simple. It takes the number of random numbers to generate as a command line argument. This number should be entered as positive, but it is cast to an unsigned long if it happens to be negative, so negative values will not break the program, but they *will* cause it to generate no less than 2^31 random numbers, which will take quite awhile and also eat up a lot of HDD space, so it is advisible that only relatively small, positive integers be used. Once this program has the number, it will proceed to write to a file called "numbers.txt" the number of numbers specified, separated by spaces. These numbers will all be positive integers between 0 and RAND_MAX. The "sorting" program includes a class called "sorts" which manages an internal list of data and provides a framework for implementing sorting algorithms which work on this list of data. Additionally, code necessary to use this class as a template class has been included, but commented out in order to make use of the class, and implementation of the sorting algorithms, simpler. If you wish to use this class as a template class, you are free to uncomment the appropriate lines and do so. The "sorts" class also provides some other basic functionality, such as a "print" function (which should only be called for test/debug purposes when working with a reasonably small list size), and the ability to get and set the pointer to the first element in the list. Note that this class requires that *your* code keep track of how many elements are in the list (the framework code already does this for you). In its current state, the "sorting" program itself will start up, and then it will open (or try to open) a file called "numbers.txt" and then load the numbers it contains into an array. The program expects that this file will contain a list of integers, separated by whitespace, and may fail in unexpected ways if the file is not formatted correctly (or if the file just plain does not exist). Once the load process is completed, the program prints the number of values loaded from the file, and then reloads the data from the file (for the second test), and then terminates. Additionally, there is framework code for setting up the calls to the different sorting algorithms and recording how long each one takes which currently prints some output, but this output should be disregarded as nothing is actually getting measured by the program at this point. It should also be noted that while functional, neither of these programs should be considered to be 'perfect,' and each one could use a little bit of improvement. For example, the "sorts" class has a method which will return a pointer to the array that the class manages, and because the pointer allows for direct manipulation of the contents of the classes' internal, private data member from outside of the class, this breaks encapsulation (and requires that you be careful with how you use this pointer), and it would be better if this methods was either removed, or modified so that it no longer broke encapsulation. For easire distribution and compilation, the code for both the "sorts" class and the main() program is in a single monolithic file. You may wish to break it up into smaller files once you have it on your PC, but this is at your discretion. Known Issues: The getFirstEntry method in the "sorts" class returns a pointer to the class's private list of data, which breaks encapsulation. The "rand" program does not perform much error checking on its command line argument. The "sorting" program does not check to make sure the input file exists before trying to read from it. Example Runs: [Note that the '>' character indicates a command prompt] >rand.exe 10 This program will write 'N' random integers to an output file called 'numbers.txt', where 'N' is provided as a command-line argument. All integers generated will be between 0 and RAND_MAX. Generating 10 random integers... Generation completed, 10 random integers have been written to 'numbers.txt'. > >sort.exe You should implement the 'instructions()' function Loading data from file 'numbers.txt'... 10 entries loaded successfully: Calling first algorithm now... The sorting process took 0 seconds for a list size of 10. Reloading data from file 'numbers.txt'... Data loaded successfully Calling second algorithm now... The sorting process took 0 seconds for a list size of 10. >