Skip to content

Instantly share code, notes, and snippets.

@CodeMonk
Created August 5, 2015 16:26
Show Gist options
  • Save CodeMonk/00335e247d5e82e51120 to your computer and use it in GitHub Desktop.
Save CodeMonk/00335e247d5e82e51120 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <sstream>
#include <iomanip>
#include <locale>
// Compile with: g++ -Wall --std=c++11 test.cc -o testing
using namespace std;
std::string FormatWithCommas(uint64_t value)
{
stringstream ss;
ss.imbue(locale(""));
ss << fixed << value;
return ss.str();
}
int main () {
for (uint64_t i=1; i < 1000000000; i += 10^i) {
cout << i << " : " << FormatWithCommas(i) << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment