Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions