Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! I require assistance with a rather complex C program. I have provided the details below: _ _ _ _ _ _ _ _ _
Hello! I require assistance with a rather complex C program. I have provided the details below:
Read in the dictionary words from a file. The name of the dictionary file must be dictionarytxtMake the following assumptions about the dictionary file:
aEach line contains the words that begin with particular letter.
bThe words in each line are separated by tab t
cEach word consists only of lowercase letters in the range az
dThe maximum length of a single line is characters
eThe maximum number of words is
Contents of dictionary.txt:
ape apple
ball bill bull
foot
parrot peeble
season
zebras zoo
If file unable to open, print: Failed to open dictionary file dictionarytxtfollowed by newline.
Write a C program that prompts the user to select from options:
Print the dictionary.
Search a word in the dictionary.
Group of letters.
Quit
Make a Selection:
If the user selects Print the dictionary":
The program should print in the screen the dictionary words from the dictionary file. After printing the dictionary file contents, it will go back to the main menu only when the user presses any key from the keyboard.
If the user selects Search a word in the dictionary":
The program should ask the user which word heshe wants to search for, read the words of the dictionary one by one, and compare each word from the dictionary with the word the user provided. Then it will print to the screen if the word is in the dicitonary or not. After printing the result from the search, it will go back to the main menu only when the user presses any key from the keyboard. The user can enter the new word to search for in uppercase or lowercase, the search must be case insensitive ex: suppose the word zebras exists in the dictionary, if the user types ZEBRAS, the word does exist in the dictionary because it is the same as zebras
If the user selects Group of letters":
The program should prompt the user for a string that contains a series of letters. The program will read in the letters and print out which dictionary words can be made from the provided letters.
In very general terms, determining if a given word can be made from the given group of letters will require counting how many distinct kinds of letters there are in the given group of letters and in each word, executing this process word by word.
For example, assume that the word bullis in the dictionary. The word bullcontains bcharacterlcharactersand ucharacterNow say the input letters were alblldiIn alblldiwe have enough bcharacters for bullsince alblldicontains at least bcharacterSimilarilyalblldihas enough lcharacters for bullsince alblldicontains at least lcharactersHoweveralblldidoes not have at least ucharacterand as such we know that we cannot make bullusing the group of letters alblldi
The program will print the words that can be made using the provided letters, and it will go back to the main menu only when the user presses any key from the keyboard.
For instance, the following would be some output from your program each example below represents a situation where the user selected the "Group of Letters" option:
first example
enter letters: alblldi
alblldi:
ball
bill
press any key to go back to the main menu
second example
enter letters: moo
moo:
press any key to go back to the main menu
third example
enter letters: bleppa
bleppa:
ape
apple
press any key to go back to the main menu
For Option the program must meet the following requirements for the group of letters option:
aThe program prints words in the dictionary that could be made in alphabetic order, as specified in the dictionary.
bThe program prints out what letters were typed infollowed by a colon :followed by a list of the words that could be made if any
cEach word that could be made is prefixed by a tab character t
dIf the user types an upper case letter your program must convert it to lower case. Case Insensitive
eThe group of letters could contain spaces or characters that are not letters of the english alphabet, and the program must remove the spaces or characters that are not letters and create a new string that only contains letters of the english alphabet. ex: if the user types "ALB@ LLdiyou must convert the string to "alblldi"
There are a lot of different ways to perform this sort of counting, but the shortest way will probably involve an array of integersone for each letter of the alphabet. The first index in this array refers to the number of acharactersthe second index the number of bcharactersand so on
This is a large request, but I would greatly appreciate any help with this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started