Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

4. What action should Cherita Howard take and why?

Answered: 1 week ago