Question: C++ Assignment 1. Write the function described below: The function is named calculateTip It takes in two parameters: one double reference parameter for the price,

C++ Assignment

1. Write the function described below:

The function is named calculateTip

It takes in two parameters: one double reference parameter for the price, one double value parameter for the tipping percentage.

It updates the price by multiplying it by 1 + the tipping percentage

It returns nothing.

2. Write the following function:

string frontBack(string str);

//Given a string, return a new string where the first and last chars have been exchanged.

//frontBack("code") "eodc"

//frontBack("a") "a"

//frontBack("ab") "ba"

3. Write the following function:

void squareArray(int array[], int size);

//Given an array of ints, add multiplies each element in the array by itself

//return nothing. Remember arrays are automatically pass by reference

//squareArray([1,2,3],3) -> [1, 4, 9]

//squareArray([3, 5, 6, 8, 9], 5) -> [9, 25, 36, 64, 81]

//squareArray([5], 1) -> [25]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!