Can anyone point me to aplace where i can find information about formatting floats or intergers. What i am looking for is to take a float and want to put a comma in the thousands, millions spot and maybe a $ in the front of the number to make it dollars.
example: i want 1000000 to look like this 1,000,000 or $1000.00 look like this $1,000.00
I not worried about decimal places i know how to do that. Just not sure and have looked all over this forum and site but can't find help. I may not be wording it right. The fill command doesn't seem to fill the bill unless i misunderstood how it is used. any help in point to the right direction would be greatly appreciated. Thank you in advance.
class Comma: public numpunct<char>// own facet class
{
protected:
char do_thousands_sep() const { return','; }// use the comma
string do_grouping() const { return"\3"; }//group 3 digits
};
int main()
{
locale myloc( locale(), // C++ default locale
new Comma);// Own numeric facet
cout.imbue(myloc);// set locale to cout
cout << 100000;
return 0;
}