Starting from:

$30

Assignment 6: Using C++ STL

CSE109 
1
Systems Software
Assignment 6: Using C++ STL
Assignment Objectives
In this assignment, students should demonstrate the following abilities:
1. Use the template class unordered_map from the STL to create a hash table
2. Read a text file of English words and store them in a hash table as a dictionary
3. Use the hash table to check the spelling of an input text file
Assignment
In this assignment, you will create a hash table and use it to store thousands of English words
that you will use as a dictionary to check the spelling of the words in an input text file.
1. Use the template class unordered_map for the type <string, string> to create
a hashtable where the key and its mapped value are both the same word.
2. Write a C++ program that reads in a text file (given as a command-line argument), parses
each word, and determines whether each word is in the hash table and if not output the
line number and the misspelled word. Use the text file words.txt as the dictionary to
fill in the unordered_map hash table. Test your spell-checker program on the provided
file sample_text.txt. Note that some words are capitalized in
sample_text.txt. A sample run of the program is provided below. You can also use
othersample text filesto verify yourspell checker program (one additional file is provided
with the assignment, speech.txt).
3. Submit your main program in a file named spell_checker.cpp.
CSE109 Lehigh University Summer 2020
2
-------------------- Sample run ---------------
>./spell_checker sample_text.txt
File words.txt opened successfully.
File sample.txt opened successfully.
line 1: misspelled word - creat
line 2: misspelled word - english
line 3: misspelled word - as
line 4: misspelled word - speling
Spell check completed.
-------------------- sample_text.txt ---------------
In this lob, you will creat a hash table.
Store English words in the hash table.
Use the hash table as a dictionary to check
the speling of the words in an input text file.

More products