. Develop a concordance generator program. The concordance will be a list of all
ID: 3771587 • Letter: #
Question
.
Develop a concordance generator program. The concordance will be a list of all the words found in a text file with a count of the number of times the word occurred and a comma delimited list of the line numbers of where the word occurred. For each line of text, all punctuation must be removed and all letters in the string forced to lowercase. Then, separate out the words and check each word against your list. Keep track of the current line number and check if the word has been found before. If the word has not been seen before, put it in some sort of collection data structure (an array or vector for example) and keep track of the line number. If the word has been found before, store the line number of where the word occurred. When the text file has been scanned, print the words and line numbers in the following format:
word : count : linenumber,linenumber,linenumber
Hint: you may need to use several arrays or vectors to store the words and the line numbers.
Explanation / Answer
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.