Question: Write the functions as described below. You need not submit programs that use these functions. ( i ) Write a function that returns the cube
Write the functions as described below. You need not submit programs that use these functions.
i Write a function that returns the cube of the integer passed to it For example cube will return and
cube will return
ii Write a void function that receives four int parameters: the first two by value and the last two by reference. Name the formal parameters n n sum and diff. The function should calculate the sum of the two parameters passed by value and then store the result in the first variable passed by reference. It should calculate the difference between the two parameters passed by value and then store the result in the second parameter passed by reference. When calculating the difference, subtract the larger value from the smaller value. Name the function calcSumAndDiff.
iii Write a function void rectangle int w int to print an open rectangle of asterisks The parameters and are the width and the height of the rectangle, expressed in number of asterisks.
iv Write a function, computePrice that receives two parameters: the first one is a character variable indicating the size of the pizza or and the second an integer variable indicating the number of toppings on the pizza. It then computes the cost of the pizza and returns the cost as a floating point number according to the rules:
Small pizza R R per topping
Medium pizza per topping
Large pizza per topping
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
