cout << print numbers with commas

I would like to format the number output from cout (or printf) with commas. I have tried to use the SetLocale() to change from the standard "C" locale to several different locales but the output dosn't change. I am using VC++ 5.0.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you will have to rewrite the << operator
for the type of number you are talking about.

you will have to write it your self.  What you can do is format the number to a string (you can use << to send the number to a string stream)  Then count the digits and insert the commas.  I'd give you an example, but I don't have time now.

It is my own method...
#include <conio.h>

void display(int number)
 int ctr, amount;
 char temp[8];
  if (ctr==3||ctr==6||ctr==9)
 } while (number>0);
      for (amount=ctr;amount>0;amount--)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LeeRAuthor Commented:
Thank you all for your responses to my question. I thought that printf would look at the settings in the "locale" struct and do formating for me, but I guess not. Oh well. Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.