Question: Requirements - C++ program Create Data Files You need to manually create at least four text files with random integer values. You dont need large

Requirements - C++ program

Create Data Files

You need to manually create at least four text files with random integer values. You dont need large number of values, which makes testing easier.

For example, you can create a file with values: 1 2 3 4 5 6 7 8 9. Save it, and make 3 copies. In each copy put a single value of 0: one towards the beginning of file, one around the middle of file, and one towards the end of file. Rename the 3 copies with name such as early.txt, middle.txt, end.txt. Keep the original one without a 0.

-- The following is the flow of the program -- Please provide comments for all tasks 1 - 4

1. Read Values from Files

The program should, for each file, read the file and put the values into an array at the start of program.

2. Simple Search

Implement a search algorithm for your program that searches for a target value in your four data files. When implemented, the program should first ask for target value and validate user input, then output whether target value is found for EACH file. Use a binary search

Example output

What is target value:

0

num.txt: target value not found

early.txt: target value found

mid.txt: target value found

end.txt: target value found

3. Sorting

There are a lot of sorting algorithms; find a basic one and implement it in your program and cite the sources. When implemented, the program should, for each file, ask user for the output file name, then use the algorithms to sort the values, and finally output the sorted values to the output files. Dont forget to print the sorted values in each file onto the screen as well.

4. Binary Search

Find a basic algorithm for binary search. Implement it in the program that searches for target value in your sorted data files from task 3. The operation should be fairly similar to the simple search.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!