CS 3100, Spring 2021
Due Monday, April 12, 2021 at midnight
Linked Lists, File I/O


All work on this assignment must be your own. You should not look at any other student's testing plans (in whole or in part, on paper or on screen), nor allow any other student to look at yours, during the course of this assignment.


The purpose of this assignment is to get a better understanding of linked lists, pointers, classes and C++-style file I/O.

Brief Description: Your program will read in a plain text file and track the individual characters in the file, keeping count of the first appearance of each character, the total count of appearances, and the last appearance.

Details:

Write a driver (client program), called homework3.cxx (or .cpp or .cc), that prompts the user for a file name to read and a file name to put the results in. The program reads the specified file, counting characters, and outputs the results to both the specified output file and standard output (cout). The results as they are calculated will be stored in a modified version of the textbook's bag class from Chapter 5, illustrating linked lists.

Given: bag3.h, bag3.cxx, node1.h and node1.cxx, courtesy of your textbook's authors. You must work with these given C++ files, and modify them to perform your program's work.

Depending upon your design decisions, you may or may not need to alter all four of these files. You will need all four for your code to compile.

Input and Output: Your program will read a plain text file. For each character the program reads, it will keep track of the first location of the character, the total number of times that character is in the file, and the last location of the character. Locations are counted, with the first character in the file being at location 1, the second character at location 2, etc. Your program will not count space characters, tab characters or newline characters.

At the end, your program will print to both standard output (your console window) and into a file the user specifies. The first line of output will be "letter first count last" followed by one line per character counted, recording the information gathered.

While running, your program will use one bag3 object to track character information, with one node per character.

Useful files:

Hint: Take a look at the C++ fstream class (file stream).

Insights and Lessons Learned. In readme.txt include a paragraph or two describing what you learned from writing and testing this program. Do your very best to make this well-written.


What To Turn In:

Here is the list of things you have to turn in:

  1. Upload to Canvas before midnight on the due date