Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <string>
  5.  
  6. int main()
  7. {
  8.     std::vector<std::string> stringVector;
  9.     stringVector.push_back("On");
  10.     stringVector.push_back("se");
  11.     stringVector.push_back("saatana");
  12.     stringVector.push_back("tyomaa.");
  13.    
  14.     std::for_each(stringVector.begin(), stringVector.end(), [](std::string word)
  15.     {
  16.         std::string reversed = "";
  17.         int stringLength = word.length();
  18.  
  19.         for (int i = stringLength - 1; i >= 0; i--)
  20.         {
  21.             reversed += word[i];
  22.         }
  23.  
  24.         word = reversed;
  25.  
  26.         std::cout << word << std::endl;
  27.     }
  28.     );
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement