My program prints out HUGE numbers – like 100363443, up to a trillion — and it sort of hard to read them, so I would like to print any number in easy to read form.
right now I use
printf ("%10ld", number);
format
I would appreciate a resulting number using printf. Most of my code is c++ yet I don’t want to introduce std::cout, as I already have printf
thanks
Use the non-standard
apostropheflag in the printf format string, if you have that option available and don’t mind losing a little bit of portability.According to my documentation, the
'flag is available for POSIX systems since 1997.If you are on Unix, Linux, Mac, … you should have no problem
If you are on Windows, DOS, iSeries, Android, … all bets are off (but maybe you can install a POSIX layer to your system).
On my system this program produces: