Answered step by step
Verified Expert Solution
Link Copied!

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 dictionary.txt.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 a-z.
d.The maximum length of a single line is 99characters.
e.The maximum number of words is 1000.
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 dictionary.txtfollowed by newline./
Write a C program that prompts the user to select from 4options:
1.Print the dictionary.
2.Search a word in the dictionary.
3.Group of letters.
4.Quit.
Make a Selection: _
If the user selects "1.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 "2.Search a word in the dictionary":
The program should ask the user which word he/she 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 "3.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 1bcharacter,2lcharacters,and 1ucharacter.Now say the input letters were alblldi.In alblldi,we have enough bcharacters for bull,since alblldicontains at least 1bcharacter.Similarily,alblldi,has enough lcharacters for bull,since alblldicontains at least 2lcharacters.However,alblldidoes not have at least 1ucharacter,and 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 3,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 26integers,one for each letter of the alphabet. The first index in this array refers to the number of acharacters,the second index the number of bcharacters,and 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

Students also viewed these Databases questions

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago

Question

1. Outline the listening process and styles of listening

Answered: 1 week ago

Question

4. Explain key barriers to competent intercultural communication

Answered: 1 week ago