Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that generates an array filled up with random positive integer n

ID: 3859427 • Letter: W

Question

Write a program that generates an array filled up with random positive integer number ranging from 15 to 20, and display it on the screen. After the creation and displaying of the array , the program displays the following: [P]osition [R]everse, [A]verage, [S]earch, [Q]uit Please select an option: Then, if the user selects: -P (lowercase or uppercase): the program displays the array elements position and value pairs for all member elements of the array. -R (lowercase or uppercase): the program displays the reversed version of the array -A (lowercase or uppercase): the program calculates and displays the average of the array elements -S (lowercase or uppercase ): the program asks the user to insert an integer number and look for it in the array, returning the message wheher the number is found and its position ( including multiple occurences), or is not found. -Q (lowercase or uppercase): the program quits. NOTE: Until the last option (‘q’ or ‘Q’) is selected, the main program comes back at the beginning, asking the user to insert a new integer number

I have attached a paper that gives the answer. I need the last portion of the answer. please help!!

New Text Document (7) #include #incl ude #1 nclude using namespace std; int main) int array[10]; srand (time (NULL)); int a-15; int b-20 forint i-0;1

Explanation / Answer

I have continued writing the code as continuation of the code given the paper.

case 'A':

case 'a':

sum=0;

for(int i=0;i<10;i++)

{

sum=sum+array[i];

}

printf("the average of the array is %f",(sum/(10.0)));

break;

case 'S':

case 's':

int search_element;

int check=0;

printf("Enter a element you want to search :");

scanf("%d",&search_element);

for(int i=0;i<10;i++)

{

if(search_element==array[i]){

printf("Element found at index of the array : %d ",i);

check=1;

}

}

if(check==0){

printf("element not found ");

}

break;

case 'q':

case 'Q':

printf("Thank you ");

exit(0);

break;

}

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote