Write a program that prompts the user to enter the number of elements and the numbers themselves to be placed in an integer array that holds a maximum of elements specified by end user. 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: Ask the user how many elements would be entered. An array of integers with this many element should then be dynamically allocated. A sort routine 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. Next include a function called by main to implement the binary search. The ordered array produced by the sort should be passed to the search routine which returns the location in the sorted array of the sought value, or -1 if the value is not in the array. Add values returning function that computes the average, median, and mode 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. Modify your program so that the data is kept in a vector instead of an array. Functionalities and calculations will be same as array solution, but you will change your solution with vector. Your implementation with vector should be in a separate file. Note 1: Do not accept negative numbers for input Note 2: Use pointers and dynamic memory allocation
Write a program that prompts the user to enter the number of elements and the numbers themselves to be placed in an integer array that holds a maximum of elements specified by end user. 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: Ask the user how many elements would be entered. An array of integers with this many element should then be dynamically allocated. A sort routine 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. Next include a function called by main to implement the binary search. The ordered array produced by the sort should be passed to the search routine which returns the location in the sorted array of the sought value, or -1 if the value is not in the array. Add values returning function that computes the average, median, and mode 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. Modify your program so that the data is kept in a vector instead of an array. Functionalities and calculations will be same as array solution, but you will change your solution with vector. Your implementation with vector should be in a separate file. Note 1: Do not accept negative numbers for input Note 2: Use pointers and dynamic memory allocation
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Write a program that prompts the user to enter the number of elements and the numbers themselves to be placed in an integer array that holds a maximum of elements specified by end user. 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:
- Ask the user how many elements would be entered. An array of integers with this many element should then be dynamically allocated.
- A sort routine 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.
- Next include a function called by main to implement the binary search.
- The ordered array produced by the sort should be passed to the search routine which returns the location in the sorted array of the sought value, or -1 if the value is not in the array.
- Add values returning function that computes the average, median, and mode 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.
- Modify your program so that the data is kept in a
vector instead of an array. Functionalities and calculations will be same as array solution, but you will change your solution with vector. Your implementation with vector should be in a separate file.
Note 1: Do not accept negative numbers for input
Note 2: Use pointers and dynamic memory allocation
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY