Question: PLEASE RIGHT IN C + + Write a program to fill a vector with 5 0 0 0 random numbers. Then display: The smallest number
PLEASE RIGHT IN C
Write a programto fill a vector with random numbers.Then display:
The smallest number
The largest number
The number of odd values
The number of even values
The totalof the values
The average of the values
Ask the user for an integer and display the subscript of the cell where it was found or NOT FOUND! if it isnt found. Use a binary search to do this.
There is a file called "Activity Sort functions.zip" under Materials in this weeks module. Download and unzip the shellSort and swapper function Download Download and unzip the shellSort and swapper function. Since you will be using a binary search, the vector will have to be in order. We will discuss sorting more in the next module, but you can use the provided code to perform the sort.
Each of the preceding values should be determined by a function andreturned to main where they should be displayed.
CODE FOR REQUIREMENT FOR THE ASSIGNMENT FROM shellSORT and swapper function zip
void shellSortvector& V
bool flag true;
int i numLength Vsize;
int d numLength;
while flag d bool flag
flag false; reset flag to to check for
future swaps
d d ;
for i ; i numLength d; i
if Vi d Vi
swapperVi Vi d;
flag true; tells swap has occurred
void swapperint &a int &b
int temp;
temp a;
a b;
b temp;
C: C:Windows backslash systemcmdexe
The smallest number is
The largest number is
The number of evens is
The number of odds is
The total of the values is
The average of the values is
Enter an integer:
Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
