Question: can someone please write the code for this question in c++ (1396) The span of a value v in an array x is the number

can someone please write the code for this question in c++
(1396) The span of a value v in an array x is the number of elements between the leftmost (smallest index) and rightmost (largest index) appearances of v (inclusive) in x. Write a function double avgSpan (int xl), int n) that returns the average span found in the parameter array x. For example, suppose array y has contents { 3 , 7 , 4 , 2 , 4 7, 2} then the span of 3 is I: the span of 7 is 6; the span of 4 is 3; and the span of 2 is 5. Thus, avgspan (y, 8) should return 18 3.75. You can assume that the parameter array x is of size n and n > 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
