Question: Dev C++ Question 4 (15 Marks) a) Given the following program segment, show the values of vals and temp variables, as well as values stored

Question 4 (15 Marks) a) Given the following program segment, show the values of vals and temp variables, as well as values stored in val array after the program is executed. Write your answer in Table 4. (3 marks) 1 2 int val() - 120, 8, 11, 15); int vals - val+3,"temp: 3 UN 4 6 7 8 temp-vals - 2; "temp-vals; Hval - * (vals-l) + 3; *vals += 5; - (val+3)"vals + 73 Table 4 [2] [3] [0] [1] vals temp val Address Ox70fdb00x70fdb4 0x70fdb80x70fdbc 0x70fda8 Ox70fdao b) Based on the program segment below and using the declared variables, complete the statement in Line 6 so that the program can display the following output: (2 marks) (Note: You are only allowed to use the relational operator, int valuel - 7; int value 2 - 7: int *ptrl - 6valuel; int *ptr2 = &value2; 1 2 3 4 5 6 7 8 9 cout using namespace std: /*) Declare prototype void function named getinput which has a double pointer as a parameter (1 mark) / /*11) Declare prototype void function named calcdiscount which has a double pointer and float pointer to constant as parameters (1.5 marks) / int main() double a: const float discount = 0.2; 2 3 4 5 6 7 B 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 get input (a) calcdiscount (la, discount); cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
