Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago