|
Home | | Requirements | |
Syllabus | |
Assignments | |
Lectures
Project Three Specifications
Introduction. This project focuses on loops (for, while, do...while) and on writing at least one function.
For this programming assignment, you will write at least one separate function (in addition to main) and make use of C++ Programs with Arguments. You may write any additional functions you deem necessary. When large amounts of text are stored or transmitted, it often pays to look for ways to compress the text into a smaller number of bits. The time needed to transmit a certain message is proportional to the number of bits in the message. Compacting the data reduces transmission time and requires fewer bits to store. One way to solve this problem is to remove certain repeating characters and replace them with a flag, character and a count.
Simple Code Compression.
The Specifications.
To complete this program you are required to use functions with parameters, selection statements, loops, and nested structures. (note: No global variables are allowed and you must use functions to keep your main program short. Therefore, you are required to use both value and reference parameters.)
Sample Interaction and Screen Output.
radius%./proj3 text3.dat @
Welcome to the Run-Length Compression Program.
The input file name: text3.dat
Corresponding Sample Input and Output Files.
--------------------Contents of text3.dat------------------ hello, not much should happen to this line iiiiiiiiii except here at the end nnnnnnnnnnnnnnnnnnnnnnn now that should be interestinggg oops...... white space counts too see?? that's all folks -----------------------End of text3.dat--------------------
--------------------Contents of w.compress------------------ hello, not much should happen to this line @i9i except here at the end @n9@n9@n5 now that should be interestinggg oops@.6 white space counts too@ 9@ 8see?? that's all folks -----------------------End of w.compress--------------------
Program testing. The directory ~csci131/PROJECTS/PROJ3 contains, among other things, files named test3, simple3.dat and text3.dat. The ".dat" files contain sample input files used to test your file yourself and in the script, test3. Copy these files into a directory that also contains your proj3.cc. Then type ./test3. The test3 script will compile your program and run it twice, once using the file simple3.dat as the file to be compressed and once using a bad filename. The runs will be concatenated into a file named output3. The perfect output, well, the output produced by my own proj3.cc can be seen in ~csci131/PROJECTS/PROJ3/model3.out. You should test your program yourself using the file text3.dat. To submit your finished project: 1. Submit your program file electronically in the directory which contains your (presumably thoroughly tested) proj3.cc. (Depending on the settings, the submit program may not accept a program that does not compile). 2. Hand in a hard copy of the file you submitted electronically. Hand this to your instructor in class on the project's due date. 3. Print out the grading header, put your name at the top of it, and hand it in with your hard copy. Get started early and have fun! Honor code: Please review the collaboration policy on the main course webpage. Also refer to the math and CS department honor code policy. Home | | Requirements | | Syllabus | | Assignments | | Lectures
Laurie King--lking at holycross.edu
|