I'm new to the forums (and C++), and hope someone can help me with a very basic program. I apologize if any etiquette has been violated.
The following is a very basic money sorting programs that works*, in which a given amount is broken up to its maximum amount of dollars, quarters, etc. (I left out nickels and pennies to shorten this post).
using namespace std;
cout<<"enter your amount in wallet"<<endl;
int dollars, quarters, dimes, nickels, pennies;
dollars=int(amount); //represents amount in full dollars
quarters=(int)((amount-dollars)/.25); //leftover quarters
dimes=(int)((amount-dollars-quarters*.25) /.1 ); //dimes left
*So I believe this program is good with one exception. When I typed in $15.20, it gives you 15 dollars, 0 quarters, and 1 dime. I'm not sure why or how I can fix it to be 2. My best guess is that quarter is ultimately a double, which messes up the intent of the italicized portion.
To be honest, I'd rather just move on and learn other things, but I thought this was weird enough for me to sign on to the forums and ask for an opinion.