I've been trying to figure out how to do this for a couple weeks and I cannot figure out how to do for the life of me. I have to get a program to do this:
Enter a 4-6 digit number: 1234
The number you entered is: 1,234
or like this 12345 into 12,345
I've been told I can do this without an if-else statement and with just simple c++ I can do it. I DO NOT want the answer I'm just wondering if anyone has any hints for me or can lead me in the right direction..
I've set it up so each number the computer reads is its own variable the problem is inserting the comma when its either 12,345 or 1,234 or 123,456... The only thing I can think of is someone inserting the comma always 3 digits before the end of the decimal place. Thanks in advanced.



LinkBack URL
About LinkBacks



This is just so annoying, I just can't seem to think of anyway to do it.
I used to be an adventurer like you... then I took an arrow to the knee.
Now I have to figure out how to add the zeros when needed.