You may have seen the word game Jumble in your newspaper. In Jumble the letters in a word are mixed up, and the reader must try to guess what the word is (there are actually four words in a Jumble...


You may have seen the word game Jumble in your newspaper. In Jumble the letters in a word are mixed up, and the reader must try to guess what the word is (there are actually four words in a Jumble game, and a short phrase whose letters have to be obtained from the four words after they are solved). For example, neicma is iceman, and cignah is aching.


Jumbles are easy for computers to solve with access to a list of words. Two words are anagrams of each other if they contain the same letters. For example, horse and shore are anagrams.


Write a program that reads a file of words and finds all anagrams. You can modify this program to facilitate Jumble-solving. Use the declaration below to store a “Jumble word”.


Each English word read from a file is stored along with a sorted version of the letters in the word in a Jumble struct. For example, store horse together with ehors. To find the English word corresponding to a jumbled word like cignah, sort the letters in the jumbled word yielding acghin, then look up the sorted word by comparing it to every Jumble word’s normal field. It’s easiest to overload operator == to compare normal fields, then you can write code like this:


A word with anagrams will have more than one Jumble solution. You should sort a vector of words by using the sorted word as the key, then use binary search when looking up the jumbled word. You can overload operator <>


You should write two programs, one to find all the anagrams in a file of words and one to allow a user to interactively search for Jumble solutions.

Nov 25, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here