printing change back for the output?

i am extremely confused as to how i would get the program to print this?
The change is: [$=7, Q=3, D=1, N=1, P=4]
i dont know how you would write a program that would know to give the exact quarters, dimes, nickels, and pennies?
i know how to write it if it was just the change but not the exact change like the above output?
please help, any help is appreciated
$7.94

dollar is easy which is 7

now you have 94 so lets start with Quarters which is really 1/4 of a dollar

so you use the modulo operator % which will give you a remainder

http://www.cplusplus.com/doc/tutorial/operators/

figure it out from there
Last edited on
Topic archived. No new replies allowed.