Question
C language: dynamic array vocabulary word bank PROBLEM: The user of your program will use it to do some elementary operations on some sets of
C language: dynamic array vocabulary word bank
PROBLEM:
The user of your program will use it to do some elementary operations on some sets of vocabulary words. Each word set consists of a list of vocabulary words that start with the same first letter, but the number of words to be entered will be specified by the user, so you do not know in advance how many words there will be in each word set. Additionally, you do not know in advance how many word sets the user will enter. Therefore, you cannot use a static array to store any of these items.
First, you should prompt the user to enter the number of word set The user will enter an integer greater than or equal to 1 to indicate the number of word sets. (NOTE: Make a point to test your program to ensure entering just 1 word set works.)
You should then prompt the user to enter the number of vocabulary words in the word set (which the user will enter as an integer greater than 0), followed by the vocabulary words themselves on the same line (newline will follow the last word on the line). Each vocabulary word is separated from the next by a space. You can assume that the user will enter the input in this format, so you do not need to check to make sure that the format of the input meets this description, and you do not need to reject input which is not properly formatted. You can also assume that the users input is correct. That is, that the number of word sets entered is actually the number of word sets in the input and that the integer entered first to indicate the number of words for each word set is actually the number of vocabulary words that follows on the same input line. Your program needs to read the user input and store the vocabulary words in each word set in a dynamically allocated array of the appropriate If you do not completely understand this description jump to the bottom of this file and check out the example data. (NOTE: Make a point to test your program to ensure that entering just 1 vocabulary word on a line works. e.g. there is only one word in the dataset and all of the functions described below behave correctly.)
8
5 Avalanche Address Aisle Alcove Admission
3 Dipstick Downtown Distance
2 Evergreen East
9 Middle Master Midshipman Mantle Mine Monument Maintain Model Mistake
6 Finish Flag Far Fletcher Farfegnugen Feather
8 Candle Cotton Cornflower Cow Clatter Chicken Children Crust
5 Slice Shoe Street Sailor Shelf
7 Toast Them Theater Tailor Treat Tall Trust
You can assume that none of the vocabulary words are longer than 20 characters. Remember that all character strings in C are null terminated and that you have to allocate space in your string for that null character, in addition to the length of the string you wish to have.
You can assume that there will be no vocabulary word duplicates.
You can assume that there will only be one line of vocabulary words that start with a particular letter.
You can use the C string library functions: strcmp(), strncmp(), strcpy() strncpy(), strcat().
You cannot use the C library function qsort().
After reading in all of the vocabulary words, your program should repeatedly do the following two things:
Print the following prompt:
Enter the starting letter of the word set on which you wish to do work:
The user will enter an uppercase or lowercase letter, followed by newline. Based on the value entered, your program must be able to access the appropriate word set in the dynamically allocated storage which you have created. Then do what is described immediately below.
Your program should then prompt the user to choose one of the following options for an operation based on the word set chosen by the user (ask the user to enter one of the six numbers, followed by enter):
1.Print out the words starting with a particular letter in the order entered.
2.Print out the words starting with a particular letter in reverse alphabetical order.
3.Find the shortest vocabulary word and print it out.*
4.Find the longest vocabulary word and print it out.*
5.Print out all of the vocabulary words in reverse alphabetical order.
6.Exit the
*If there is more than one vocabulary word of shortest or longest length, print the first one found.
After the user selects one of the six options, your program should perform the necessary operation or print the specified data or terminate the program. The program should output the result with an appropriate message, for example, for option 1 the output would be:
Vocabulary words that start with D are: Dipstick Downtown Distance
After your program outputs the result of the operation, it should prompt the user again to select one of the word sets, and then one of the six options until the user selects option 6 to exit the program.
Similar Question: https://www.chegg.com/homework-help/questions-and-answers/c-language-pointers-dynamic-memory-allocation-functions-arrays-dynamically-allocated-probl-q18328798?trackid=188ae9ac&strackid=3d2b78c0&ii=7
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