subject

Write a program that reads numbers from a file named nums. txt Download nums. txt and saves them in an array. your array should be all filled and has the exact size of the number of data in the file. You should count how many numbers the file has, then create your array. The program should then prompt the user for an integer which will be searched for in the array using a binary search. Make sure to include the following steps along the way: i)A sort function must be called before the binary search. You may use either the selection sort or the bubble sort. However, the sort must be implemented in its own function and not in main. ii) A binary search function must be called by main to implement the binary search. The ordered array produced by the sort should be passed to the search function which returns the location in the sorted array of the sought value, or -1 if the value is not in the array. iii) Add a value-returning function that computes the mean of your data set. Recall that the mean is the sum of the data values divided by the number of pieces of data. Your program should output the size of the array entered, the array as entered by the user, the sorted array, the integer being searched for, the location of that integer in the sorted array (or an appropriate message if it is not in the array), and the mean of the data set. The output must be saved to a text file and output to the screen. Sample run: Sample run: Enter an integer to search for: 100 // notice that your program must save the same output in a file. This array has 12 items. The array entered by the user is as follows: 22 -4 5 100 39 20 88 10 55 3 10 78 The sorted array is as follows: -4 3 5 10 10 20 22 39 55 78 88 100 The item searched for is 100 The value 100 is in position number 12 of the list The mean of all the elements in the array is 35.5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Draw the hierarchy chart and design the logic for a program that calculates service charges for hazel's housecleaning service. the program contains housekeeping, detail loop, and end-of-job modules. the main program declares any needed global variables and constants and calls the other modules. the housekeeping module displays a prompt for and accepts a customer's last name. while the user does not enter for the name, the detail loop accepts the number of bathrooms and the number of other rooms to be cleaned. the service charge is computed as $40 plus $15 for each bathroom and $10 for each of the other rooms. the detail loop also displays the service charge and then prompts the user for the next customer's name. the end-of-job module, which executes after the user enters the sentinel value for the name, displays a message that indicates the program is complete.
Answers: 2
question
Computers and Technology, 24.06.2019 00:00
Visualizing a game of β€œtag” to remember the meaning of contagious
Answers: 3
question
Computers and Technology, 24.06.2019 00:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. obfuscate: to make something so confusing that it is difficult to understand.
Answers: 2
question
Computers and Technology, 24.06.2019 11:00
Need fast im timed in a paragraph of 125 words, explain at least three ways that engineers explore possible solutions in their projects.
Answers: 2
You know the right answer?
Write a program that reads numbers from a file named nums. txt Download nums. txt and saves them in...
Questions
question
Social Studies, 08.01.2020 05:31
Questions on the website: 13722360