Created
August 5, 2015 16:26
-
-
Save CodeMonk/00335e247d5e82e51120 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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