Computer Science Homework Help

The parts of this question all relate to C++. Suppose the function cube () takes one integer parameter, × adds 1 to x and returns the cube of the result. The parameter × might be passed by value or by

The parts of this question all relate to C++. Suppose the function cube () takes one integer parameter,

Get Your Custom Essay Written From Scratch
We have worked on a similar problem. If you need help click order now button and submit your assignment instructions.
Just from $13/Page
Order Now

× adds 1 to x and returns the cube of the result. The parameter × might be passed by value or by

reference.

Now assume that main has a variable int kk that currently stores the value 10.

(a) (2) In C++, define cube () using call-by-value.

(b) (2) In the context of main, write a call on cube () with kk as its parameter.

(c) (2) What value is returned by cube () in part (b)?

(d) (2) What value is in kk when the call returns?

(e) (2) In C++, define cube () using call-by-reference.

(f) (2) In the context of main, write a call on cube () with kk as its parameter.

(g) (2) What value is returned by cube () in part (f)?

(h) (2) What value is in kk when the call returns?