fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. std::string zu_string(int x)
  5. {
  6. std::string fertig;
  7. do
  8. fertig.push_back(x % 10 + '0');
  9. while(x /= 10);
  10. std::reverse(fertig.begin(), fertig.end());
  11. return fertig;
  12. }
  13.  
  14. std::string operator+(const std::string& b, int a)
  15. {
  16. return (b + zu_string(a));
  17. }
  18.  
  19. int main()
  20. {
  21. std::string x = "123" + 4;
  22. std::cout << x;
  23. }
  24.  
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
;(