fork download
  1. #include <iostream>
  2. #include <string>
  3. static const std::string chars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456\
  4. 789");
  5.  
  6.  
  7. template<int n>
  8. void pp(const std::string& p)
  9. {
  10. for (std::string::const_iterator i = chars.begin();
  11. i != chars.end(); ++i)
  12. pp<n-1>(p + *i);
  13. }
  14. template<> void pp<1>(const std::string& p)
  15. {
  16. for (std::string::const_iterator i = chars.begin();
  17. i != chars.end(); ++i)
  18. std::cout << p + *i << std::endl;
  19. }
  20. int main(int, char **)
  21. {
  22. pp<3>("");
  23. }
  24.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty