[Solved]Write Complete Program Main Function Function Called Average Ref Slides 68 69 Lec W9 Array Q37129776

Write a complete program that will have a main function and a function called average. (Ref slides 68 and 69 of lec W9 arrays, slides 47 to 49 of lecW6 func) 1) Function average will only have a 2D integer array parameter with 2 rows and 3 columns. This function will return the average of the elements stored in 2D array. Use nested counter-controlled for loop. (Use array template instead of built-in array) a. b. In mainO, declare a 2D integer array template called t with 2 rows and 3 columns. c. In mainO, initialize the array using initializer list such that: . First row will have values 1, 2, 3 (from left to right) . Second row will have values 6, 8, 0 (from left to right) Call the function average from main such that it will return the average of the elements stored in array t. d. e. In main0, store the value returned from the function average in a variable. Then, print that variable. 2) Write a complete program that will do the following: a) Declare an empty integer vector (without mentioning any size). b) Use a loop to read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read from user, validate it (i.e. check whether it is between 10 and 100). Store the valid number in the vector only if it isn’t a duplicate of a number already in vector. Use push_back function to add each unique value to the vector. c) d) Display only the unique valid values that the user entered. (Hint: print vector) Submissien: Show transcribed image text Write a complete program that will have a main function and a function called average. (Ref slides 68 and 69 of lec W9 arrays, slides 47 to 49 of lecW6 func) 1) Function average will only have a 2D integer array parameter with 2 rows and 3 columns. This function will return the average of the elements stored in 2D array. Use nested counter-controlled for loop. (Use array template instead of built-in array) a. b. In mainO, declare a 2D integer array template called t with 2 rows and 3 columns. c. In mainO, initialize the array using initializer list such that: . First row will have values 1, 2, 3 (from left to right) . Second row will have values 6, 8, 0 (from left to right) Call the function average from main such that it will return the average of the elements stored in array t. d. e. In main0, store the value returned from the function average in a variable. Then, print that variable. 2) Write a complete program that will do the following: a) Declare an empty integer vector (without mentioning any size). b) Use a loop to read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read from user, validate it (i.e. check whether it is between 10 and 100). Store the valid number in the vector only if it isn’t a duplicate of a number already in vector. Use push_back function to add each unique value to the vector. c) d) Display only the unique valid values that the user entered. (Hint: print vector) Submissien:
Expert Answer
Answer to Write a complete program that will have a main function and a function called average. (Ref slides 68 and 69 of lec W9 a… . . .
Related