I need help writing a program in c We are using visual studi
I need help writing a program in c++. We are using visual studios and I can not figure out this program. He gives us his own dictionary so we are able to read in the dictionary to find the word ladder. The link to his dictionary is https://mycourses.msstate.edu/bbcswebdav/pid-898382-dt-content-rid-5747277_1/xid-5747277_1
Introduction
A word ladder is a type of puzzle invented by Lewis Carroll in 1878. The idea is to transform one word to another a step at a time by forming a sequence of words each of which differs from its predecessor by a single letter at a time. A simple example is the word ladder from cat to dog: cat cot cog dog Other examples include code to data: code cade cate date data and tears to smile tears sears spars spare spire spile smile Your program will ask the user to enter a start and a destination word and then your program is to find a word ladder between them if one exists. For simplicity sake we will assume that all words in the dictionary will be of the same length (5 letters). Not all start-end word combinations will have a valid word ladder. If this happens indicate to the user that no such word ladder exists. Some start-end word combinations will have more than one possible word ladder between them. Your program only has to find one word ladder, not all possible word ladders between words. The user can continue to request other word ladders until they are done.
Instructions
To solve this problem you must use the Standard Template Library (STL) Stacks, Queues, and Sets. The API for STL containers can be found here: http://www.cplusplus.com/reference/stl/ A Set is a way of collecting data similar to a List or an Array. You will store the words from the dictionary into a Set. Get the starting word from the user and find all words in the dictionary that are 1 letter different. For each word that is one letter different create a Stack object, push on the start word and the word that is 1 letter different. Enqueue each of these stacks onto a Queue (creating a queue of stacks). Then dequeue the first item from your queue (this item is a stack). Look at the top word of this stack and compare it with the ending word, if they are the same, then your stack contains a ladder from the start word to the end word. If the words are not the same, then find all the words that are 1 letter away from this new word. For each of these new words you just found, create a copy of the current stack and push the new word on it. Then enqueue all the newly created stacks onto the queue ... you will terminate when the queue is empty or you have found the ending word. You must keep track of the words in the dictionary that have already been used; otherwise an infinite loop will result. Your program should check and display a helpful error message if the dictionary file cannot be opened or does not exist and then quit. The program should also print an error message and quit if the user enters a starting or ending word that does not contain 5 letters.
Sample Execution
Enter start word (leave blank to quit): tears
Enter end word: smile
Found ladder: tears sears spars spare spire spile smile
Enter start word (leave blank to quit): airplane You must enter words that are 5 letters long.
Enter start word (leave blank to quit):
Solution
void processMainGame(Lexicon dictionary, string startWord, string endWord)
{
Queue<Vector<string> > theFIFO;
Lexicon alreadyUsed;
string nextStr;
theFIFO.clear();
Vector<string> addToQueue;
addToQueue.add(startWord);
// start the queue
theFIFO.enqueue(addToQueue);
while (true)
{
// build up a new list of items to search, or stop if empty
if (theFIFO.size() ==0)
{
cout << \"Nope nothing found! no ladder\"<< endl;
break;
}
Vector<string> newString = theFIFO.dequeue();
while (true)
{
// find the next word to use
nextStr = findNextWord(newString[newString.size()-1], dictionary, alreadyUsed);
// the end of the search
if (nextStr == endWord)
{
cout << \"FOUND ladder !!\" << endl;
foreach (string list in newString)
{
cout << list << \" - \";
}
cout << endWord << endl << endl;
return;
} else if (nextStr != \"\")
{
// if there is another word to search with add to the end of the list
Vector<string> addMore = newString;
addMore.add(nextStr);
theFIFO.enqueue(addMore);
}
// else if nothing left to search for stop!!
else if (nextStr ==\"\")
break;
alreadyUsed.add(nextStr);
}
}
}


