Advertisement
BojidarDosev

reverse a string

Mar 16th, 2024
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <cmath>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     string str = "I am Bozhidar dosev.";
  12.     vector<char> data(str.begin(),str.end());
  13.     int a = 0;
  14.    
  15.  
  16.     for (int i = str.length()-1; i >-1.; i--)
  17.     {
  18.         cout << data[i];
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement