Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++!!! Q1: Write a program that will Read in the contents of a text file up to a maximum of 1024 words you create your

C++!!!

Q1: Write a program that will

Read in the contents of a text file up to a maximum of 1024 words you create your own input.

When reading the file contents, you can discard words that are single characters to avoid symbols, special characters etc.

Sort the words read in ascending order in an array (you are not allowed to use Vectors) using the Selection Sort algorithm implemented in its own function.

Search any item input by user in your sorted list using the Binary Search algorithm implemented in its own function.

Use string comparisons as taught in CIS 22A for comparing/ ordering words, i.e. words starting with numbers sort lower than words starting with uppercase letters which are lower than words starting with lowercase letters. So a word appearing once with one set of case is different than its second appearance with a different set of case, e.g. 'Do' and 'do' are not the same.

If a word appears twice using exactly the same case, it can be stored twice side-by-side in the array and either index can be returned in the search.

Your program will first ask the user for a location+name from where to read the file and location+name where to save the output file. Read the contents into an array, ignoring single character words. Sort the contents of the array in alphabetically ascending order and then start a loop to allow the user to search for one or more words in the array - your loop should have an appropriate exit condition. If the word is found, the program should output which array location the word was found in, if not found then it should output an appropriate message. Provide clear prompts as necessary for good user interactivity. Your output should be sent to both screen and an output file concurrently. Screen output should contain the entire user interaction. The file output should contain all the user interaction that went to the screen as well as the listing of the sorted array. User interactivity should be limited to your main, input and/or output functions only - what that means is your cin/cout should only be in those 3 functions.

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

Students also viewed these Databases questions

Question

4. Develop a self-directed learning module.

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago