fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. int main()
  6. {
  7. // Conversion of Java : String op="text1 "+z+" text2"+j+" text3"+i+" "+Arrays.toString(vol);
  8.  
  9. int i = 0, j = 0, z = 0;
  10. std::vector<int> arr;
  11. arr.push_back(15);
  12. arr.push_back(18);
  13. arr.push_back(0);
  14.  
  15. std::string result = "text1 " + std::to_string(z);
  16. result += " text2" + std::to_string(j);
  17. result += " text3" + std::to_string(i) + " ";
  18.  
  19. for ( auto& el : arr )
  20. result += std::to_string(el);
  21.  
  22. std::cout << "The result string is :" << result << std::endl;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
The result string is :text1 0 text20 text30 15180