Description
The objective of this homework is to create structures, read from, create and write to files using C++.. This assignment will incorporate arrays
Scenario:
You are a programmer tasked to take the plain text from a series of formatted files and create a library card catalog file and a statistics file.
Requirements:
- Ask the user for the name of the file to be processed.
- Attempt to open the file of the given name. If unsuccessful, it should output an error message and prompt the user to enter another file name.
- With the file open, read into a Structure:
- Title
- Author full name (the name is stored in the file as First and Last name with a space between)
- Word Count (total number of words in the book contents. A word is one or more letters
(not counting punctuation) separated by a space so ice cream is considered 2 words)
- Letter frequency (this is the number of times each letter has been encountered in the book contents)
- Line Count (count of new line characters in the contents section)
- Save this information in the file CardCatalog.txt
- If the file doesn’t exist, create it.
- If the file does exist, append to it.
- Leave a blank line between each card catalog entry.
- The file should be human readable such as (is should be similar but not necessarily the same as the following*):
Title: Moby Dick
Full Author: Herman Melville
Author First Name: Herman
Author Last Name: Melville
Word count: 375
Line count: 17
- Ask the user if they want to see the letter frequency. If they agree, it should look like*: Moby Dick letter frequency:
a: 0.0762% b: 0.0 % c: 0.0253% d: 0.0405%
- Ask the user if they wish to process another book. If they do, repeat requirement 2. If
they don’t, program should quit. This should not add to previous results.
(*) The numbers shown heer are not necessary correct