fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string fun(string &t, string s = "", int r = 2) {
  6. while(--r)
  7. s += s;
  8. t = t + s;
  9. return s;
  10. }
  11.  
  12. int main() {
  13. string name = "x";
  14. cout << fun(name, name);
  15. cout << name;
  16. return 0;
  17. }
  18.  
  19.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
xxxxx