I DONT KNOW WHERE TO START! Write a program to manage a dictionary. Your diction
ID: 3531494 • Letter: I
Question
I DONT KNOW WHERE TO START!
Write a program to manage a dictionary. Your dictionary should be stored on a text file named diction.txt and consist of an alphabetized list of words, one per line. When a user enters a word, scan the dictionary looking for the word. If the word is in the dictionary, say so. If not, display the dictionary word immediately preceding and the word immediately following so that user can see words that are close in spelling. Then ask whether the user wants to add this new word to the dictionary. If the answer is yes, do so and go back to request the next word.
To insert a word into a file in alphabetical order, simply copy the file to a new temporary file named diction.tmp and move words one at a time from the temporary file back to the original file, inserting the new word when you reach its correct position alphabetically. Turn in your source code and your diction.txt file.
Explanation / Answer
The first thing you need to do is create that text file, unless your teacher gave you one. If you google around for dictionary text files you may be able to find one.
After that, write your program one small step at a time. you know that you have to ask the user for a word, so start out your program with just that informaton. Compile and get it working before moving on gto the next part of the assignment.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.