fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. std::string encode(int i, const std::string& text)
  5. {
  6. std::string value;
  7. for(char c : text)
  8. {
  9. if (c == ' ') {
  10. value+= " ";
  11. continue;
  12. }
  13.  
  14. value += static_cast<char>(c+i);
  15. }
  16.  
  17.  
  18. return value;
  19. }
  20.  
  21. int main()
  22. {
  23. std::cout << encode(5, "Uciekaj Cezarze! Nadciaga wojna mieszkaniowa!").c_str();
  24. return 0;
  25. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Zhnjpfo Hjfwj& Sfihnflf |tosf rnjxpfsnt|f&