How to print a string with a reverse iterator in C++

1 Answer

0 votes
#include <iostream>
#include <string>

int main() {
    std::string str = "c c++ java python";

    std::cout << std::string(str.rbegin(), str.rend()) << std::endl;
}



/*
run:

nohtyp avaj ++c c

*/

 



answered May 25, 2024 by avibootz

Related questions

2 answers 145 views
1 answer 192 views
1 answer 209 views
1 answer 168 views
1 answer 188 views
1 answer 195 views
1 answer 193 views
193 views asked May 5, 2018 by avibootz
...