fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string pow(std::string s, int n)
  6. {
  7. return (n > 1) ? s += pow(s, n - 1) : s;
  8. }
  9.  
  10. int main()
  11. {
  12. string str = "1";
  13. str += pow("ab", 5);
  14.  
  15. cout << str;
  16. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
1ababababab