Search
 
SCRIPT & CODE EXAMPLE
 

CPP

string reverse stl

int main() { 
    string str = "foobarbaz";
    reverse(str.begin(), str.end()); 
    cout << str; // prints "zabraboof"
    return 0; 
} 
Comment

How to reverse a string in c++ using reverse function

#include <iostream>
//The library below must be included for the reverse function to work
#include<bits/stdc++.h> 
using namespace std;

int main() {
  
  string greeting = "Hello";
  //Note that it takes the iterators to the start and end of the string as arguments
  reverse(greeting.begin(),greeting.end());
  cout<<greeting<<endl;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to install boost c++ on windows 
Cpp :: max value of double c++ 
Cpp :: c++ function as param 
Cpp :: sort vector using marge sorting in c++ 
Cpp :: c++ std::sort 
Cpp :: how print fload wiht 3 decimal in c++ 
Cpp :: how to make a list in c++ 
Cpp :: error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ 
Cpp :: c++ function 
Cpp :: how to create a min priority queue of pair of int, int 
Cpp :: memset in c++ 
Cpp :: less than operator overloading in c++ 
Cpp :: read comma separated text file in c++ 
Cpp :: what does the modularity mean in c++ 
Cpp :: count number of set bits C++ 
Cpp :: 1d array 
Cpp :: Xor implementation C++ 
Cpp :: migration meaning 
Cpp :: set clear c++ 
Cpp :: what is c++ standard library 
Cpp :: use uint in c++ 
Cpp :: print octal number in c++ 
Cpp :: long to string cpp 
Cpp :: cpp when use size_t 
Cpp :: char to integer c++ 
Cpp :: sort vector of strings 
Cpp :: c ifdef 
Cpp :: creare array con c++ 
Cpp :: c++ string slicing 
Cpp :: how to initialize 2d array with values c++ 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =