Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

1. a. Using C/C++, define an integer array with 20 elements; assign the arrays with random numbers between [0, 99] by calling rand(); then define

image text in transcribed
1. a. Using C/C++, define an integer array with 20 elements; assign the arrays with random numbers between [0, 99] by calling rand(); then define a function and implement selection sort to sort the array (pass the array and its size as parameters from main to the function): print the array before and after sorting: b. Similar to a, define an integer array with 20 elements; assign the arrays with random numbers between [0, 99]: then define a function and implement bubble sort to sort the array (pass the array and its size as parameters from main to the function); print the array before and after sorting: c. following a, using CIC++, define a function and implement binary search to search in the sort the array; in main(), define an integer N, assign its value from keyboard (cin), and call the binary search function to search N in the array, print yes if found, and no if not. 2. Using CIC++, define a two dimensional integer array with 5 rows and 5 columns (e.g. n[5][5]). Assign the array with random numbers between 10 and 100 using randO then define two arrays: S[5] and A[5] and use loops to calculate the sum and average of the numbers in each column of the two dimensional array, assign the results to S and A, respectively (Le. Calculate the sum and average of the numbers from nolol to n[4110] and assign it to S[0] and A[0], calculate the sum of the numbers from n[O 1] to n[411] and assign it to S[1] and A[1] etc.) Output the results in S array and A array finally, count how many even numbers of the two dimensional array has and output the result

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions