Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the code I have for the screenshot C++ coding assignment! I am not getting the sample run output and This is the feedback

This is the code I have for the screenshot C++ coding assignment! I am not getting the sample run output and This is the feedback I have from a school tutor. please help me fix this!

feedback:

You may not have had enough time to check your programs output and whether it fits to the task. For assignment the output must be saved to a text file and output to the screen. Your program does just output to the file and does not show output to the screen. Your program should output array as entered by user, the sorted array. But in your program two sorted arrays are in output . Pay more attention to the task and sample run in the task. I don't think that we are allowed to use #include and dynamically allocate an array in our assignments because we did not use it in the class exercises, but it is good that you found it and know how to use it

image text in transcribedimage text in transcribed
Write a program that reads numbers from a le named nums.txt i, and saves them in an array. your array should be all lled and has the exact size of the number of data in the le. You should count how many numbers the le 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 le and output to the screen. Sample run: Sample run: Enter an integer to search for: 100 5' notice that your program must save the same output in a le. 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 foris 100 The value 100 is in position number 12 of the list The mean of all the elements in the array is 35.5 Write a program that reads numbers from a file named nums.txt _ Minimize File Preview - ZOOM + 22 4 5 100 39 20 88 10 55 3 10 78

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions