1. Originally Posted by mjpam
It's not necessarily overcomplicated if he has to use a function to calculate the change. In that case, it would best to use a function that returns all four numbers at once rather than four functions to return the number of each coin separately.

So, Cody, do you have to use functions (other than main) in your program?
You're right of course, if that is the restriction then he is going about it right, but the method I posted above is still useful for avoiding the floating points and finding remainders simply.

2. Originally Posted by mjpam
It's not necessarily overcomplicated if he has to use a function to calculate the change. In that case, it would best to use a function that returns all four numbers at once rather than four functions to return the number of each coin separately.

So, Cody, do you have to use functions (other than main) in your program?
You can't return 4 things at once. There is a difference between what you are trying to say and what you are actually saying, and this can be very confusing to a beginner.

3. Originally Posted by claudiu
You can't return 4 things at once. There is a difference between what you are trying to say and what you are actually saying, and this can be very confusing to a beginner.
Yeah, sorry. I mean "pass", I think.

4. Originally Posted by KBriggs
You're right of course, if that is the restriction then he is going about it right, but the method I posted above is still useful for avoiding the floating points and finding remainders simply.
You're very right that the rest of your post was very helpful, but I was just trying to point out that using pointers is necessary if he is trying pass (is that the correct terminology, claudiu?) for variables (or at lest their pointers) backing main.

If I understand what is being done correctly, you pass the pointers to the variables to the function and modify the values of the variables pointed to be the pointers in the function.

5. I think the value of pennies gets messed up through all the type conversions, and it may be a rounding issue. I got some results by adding 0.5 to the pennies and casting it as an integer.