Question: Dev C++ Question 2 (22 Marks) a) Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement
Dev C++
Question 2 (22 Marks) a) Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement according to the instructions stated in the comments. This program copies all the elements of a 2D array to a ID array. Then, double the sum of all the elements. (12 marks) #include using namespace std; //i) Write DoubleTotal function prototype (1.5 marks) 000 UN int main() /*ii) Declare 2D array type integer, 3 rows 2 columns named Arri with initial value: 1,2,3,4,5,6 (1.5. marks) */ /*iii) Declare 1D array type integer named Arr2 with size declarator 6 (0.5 mark) */ 14 15 16 17 18 19 20 int n = 0; //iv) Copy all elements of array Arri to Arr2 (3 marks) NH NNNNNNNNN n++; ) /*v) Call function DoubleTotal, pass array Arr2 and display the returned value (1.5 marks) / 28 29 30 31 32 33 34 return 0; //DoubleTotal Function definition double DoubleTotal(int A[], int x){ double sum= 0; 35 36 37 38 39 40 V/vi) Calculate sum of all elements (2.5 marks) V/vii) Multiply sum by 2 (1.5 marks) 42 43 44 45 46 return sum b) Trace the following program segment. Write the elements of each array after execution of the statement(s) in Table 2. (10 marks) 1 2 3 4 int subs [3] -(1,2,3), mask2D[3] [3] ={17), 2, 4, 12,9,5); int i, j, x = 1; for(i 0; i