Using iterators that demonstrates the use of functions rbegin and rend. - C++ STL

C++ examples for STL:string

Description

Using iterators that demonstrates the use of functions rbegin and rend.

Demo Code

#include <iostream>
#include <string>

int main(int argc, const char* argv[]) {
    std::string str = "now step live...";

    std::string::reverse_iterator rit = str.rbegin();

    while (rit != str.rend()) {
        std::cout << *(rit++);/*from ww w  . j a  va2s. c  o m*/
    }
    std::cout << std::endl;

    return 0;
}

Result


Related Tutorials