Question: IN C++ The following function uses reference parameters to compute the size of a chain in feet and inches given the size of the chain

IN C++

The following function uses reference parameters to compute the size of a chain in feet and inches given the size of the chain in inches, and returns the total cost of the chain. Rewrite the function so it uses pointers instead of reference parameters. double chain (int totalInches, int &feet, int &inches) { feet = totalInches/12; inches = totalInches%12; return feet*3.49 + inches*.30; } Use the main function to demonstrate your functions. Declare two int variables f and i and set them to 0. Input the size of chain in inches. Then call the chain function so the values computed for feet and inches get stored in f and i. Then output the result, and new values of f and i. Use cout << fixed << setprecision(2); to format the cost to two decimal places. Ex: If the input to the program is: 30 the output is: 2 feet and 6 inches. Cost: $8.78 Your program must define and call a function named chain with three parameters in the order described above, that returns a double value.

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!