Created
December 11, 2009 08:16
-
-
Save cxx/254060 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <algorithm> | |
#include <boost/lexical_cast.hpp> | |
int main(int argc, char* argv[]) | |
{ | |
int post_id = boost::lexical_cast<int>(argv[1]); | |
std::string s; | |
char path_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
while (post_id > 0) { | |
s += path_chars[post_id % 36]; | |
post_id /= 36; | |
} | |
std::copy(s.rbegin(), s.rend(), std::ostreambuf_iterator<char>(std::cout)); | |
std::cout << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment