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, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display “enter a value to be cubed.” input value; set cube = value ^ 3 display value, “ cubed is “, cube end while
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
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
Mathematics, 14.10.2019 20:00
question
Mathematics, 14.10.2019 20:00