Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Dev C++ image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions