fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6.  
  7.  
  8.  
  9. string szyfr (string s){
  10.  
  11. string t="";
  12.  
  13. int i; for (i=0; i<s.size()-1; i+=2)
  14.  
  15. t=t+s [i+1]+s[i];
  16.  
  17. if (s.size()%2!=0)
  18.  
  19. t=t+s[s.size()-1];
  20.  
  21. return t;
  22.  
  23. }
  24.  
  25. int main() {
  26.  
  27. cout <<szyfr("kotwica")<<endl;
  28.  
  29. cout <<szyfr("szyfrowanie jest trudne")<<endl;
  30.  
  31.  
  32.  
  33. return 0;
  34.  
  35. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
okwtcia
zsfyorawin eejtst urnde