Explore BrainMass
Share

Explore BrainMass

    C+ programming functions program

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a C function named change() that accepts a floating point number and the addresses of the integer variables named quarters, dimes, nickels, and pennies. The function should determine the number of quarters, dimes, nickels, and pennies in the number passed to it and write these values directly into respective variables declared in its calling function.

    © BrainMass Inc. brainmass.com October 9, 2019, 3:35 pm ad1c9bdddf
    https://brainmass.com/computer-science/programming-languages/c-programming-functions-program-7961

    Solution Preview

    You will have to make this code compile and run, but all the basic ideas are here and explained below.
    <br>
    <br>void change(
    <br> float amountNeedingChange, //this is the input dollars to be changed
    <br> int *pNQuarters, // pointer to output number of quarters
    <br> int *pNDimes, // pointer to output number of dimes
    <br> int *pNNickels, //pointer to output number of nickels
    <br> int *pNPennies //point to output number of pennies
    <br> )
    <br> {
    <br> int remainder; //this is the amount left over ...

    Solution Summary

    C+ programming functions program is modeled.

    $2.19