Can someone explain this to me?

closed account (4wRjE3v7)
How would you turn a value for example 100 using modulus to determine the dollar amount, penny amount, quarter amount, etc?

Can someone explain this to me?

EX:

Scenario: Kids these days! You are the new shift manager at the
* local Tast-E-Freeze ice cream shop. Every day the high schoolers
* working the counter are up in arms about the fact that you expect
* them to make change WITHOUT A CALCULATOR! Needless to say, the
* cash balance is always off at the end of the day. You are fed up
* and decide to write a program to help the kids make change. What
* are they teaching in school these days anyway??!!
*
* INPUT: Ask the teenie-bopper working the desk to enter the amount due
* and the amount paid by the customer
* OUTPUT: The number of dollars, quarters, dimes, nickels and pennies (s)he will
* need to use to give the customer the correct change
* ******************************************************** */
My first answer is going to be fire the person who can't figure out how much change to give someone after being told the amount to give them.

I.E. cost=12.37, payment=15.00, change=2.63
if they can't figure out that they need to hand the customer 2 dollar bills two quarters a dime and three pennies, fire them! in the mean time it is an interesting problem I am working on right now for you.
modulas is not the answer as an operator becuase you will always be using doubles in your calculations I.E. 12.37 15.00
Last edited on
closed account (4wRjE3v7)
Thank you I appreciate it!!:)
modulas is not the answer
There is an fmod() in <cmath>
Topic archived. No new replies allowed.