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 dictionarytxt Make the following assumptions about the dictionary file:
a Each line contains the words that begin with particular letter.
b The words in each line are separated by tab t
c Each word consists only of lowercase letters in the range az
d The maximum length of a single line is characters.
e The 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 dictionarytxt followed 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 bull is in the dictionary. The word bull contains b character, l characters, and u character. Now say the input letters were alblldi In alblldi we have enough b characters for bull since alblldi contains at least b character. Similarily, alblldi has enough l characters for bull since alblldi contains at least l characters. However, alblldi does not have at least u character, and as such we know that we cannot make bull using 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:
a The program prints words in the dictionary that could be made in alphabetic order, as specified in the dictionary.
b The program prints out what letters were typed in followed by a colon : followed by a list of the words that could be made if any
c Each word that could be made is prefixed by a tab character t
d If the user types an upper case letter your program must convert it to lower case. Case Insensitive
e The 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@ LL di you 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 integers, one for each letter of the alphabet. The first index in this array refers to the number of a characters, the second index the number of b characters, and so on
This is a large request, but I would greatly appreciate any help with this. If I could give more than one thumbs up for this, I would.
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