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

write the prototype for a function called myFunc2 that takes 2 integer values Q2

ID: 3835111 • Letter: W

Question

write the prototype for a function called myFunc2 that takes 2 integer values Q2 points consider the array defined as follows: int price 1551 16,7,9,2, 3, 4,5, 6,7,8, 9,0,1, 5, 4, 7,2 a I. pointl How many elements does this amay have? 2. Il point) write a statement that stores the value of 49 in the lastelement of the amy. 3, II point What will be printed by the following statement cout Price 111 price 1213 4. point what will be printed by following statement 5. 12 points] Write C++ statements (not a full program) that print the summation of the elements of the array price starting from element pricello)till the end Ge. last element) of the array. B points (a) II pointl Writethe prototype for a function called myFunc2 thattakes two integer values and prints the larger of these two values. (b) 12 pointsl Write the full function myFunc2.

Explanation / Answer

1) We have array price[55] = {6,7,9,2,3,4,5,6,7,8,9,0,1,5,4,7,2}

The array has 17 elements but array have the capability of 55 elements.

2) Now as we have array of maximum capacity of 55 elements hence last element would be stored at 54th index location
price[55] = 49;

3) Array index starts with 0, so here at 1st index we have 7 and index 2 we have 9
price[1] = 7
price[2] = 9
price[1]+price[2]
7+9
16

Hence 16 will be printed.

5) We can loop from index ten till end of array and sum all elements
int sum = 0;
for(int i =10;i<price.length();i++)
{
sum = sum + price[i];
}

Function prototype:

void myFunc2(int a , int b)
{
}