Need help with a math function on this code.

I'm having trouble with this code for the 20K to below 100k.. I think it's the math but it could be something more simple that I'm missing.. The error is in the printFiveDigit2 function..

Could anyone help me out?? Thanks in advance!! :)

Here's what happens...

Input a full dollar amount:
> 34885
thousand eight hundred eighty five dollars and 00 cents.
> 34085
thousand eighty five dollars and 00 cents.

Now it works from 10k to 19999.99 but above that for some reason it doesn't and I've been working on it for days..


Code : Removed code...
Last edited on
n % 100000/100000 is always 0;
I've changed it but it's still showing this..

Input a full dollar amount:
> 23456
two thousand four hundred fifty six dollars and 00 cents.
>

Also to note; when I put in an amount 30000 or larger it crashes the program...
/bump
/bump
/bump
I've changed it

To what?

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Changed the amount as MiiNiPaa suggested from n % 100000/100000 is always 0;

in void printFiveDigit2(unsigned n) but it's still not working as stated above..
Last edited on
/bump
Never mind... I solved it myself..

After working on it for a while longer I figured it out...

Results on screen..

Input a full dollar amount:
> 90234
ninety thousand two hundred thirty four dollars and 00 cents.
> 99999.99
ninety nine thousand nine hundred ninety nine dollars and 99 cents.
>
Topic archived. No new replies allowed.