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 139 views
1 answer 187 views
1 answer 203 views
1 answer 159 views
1 answer 184 views
1 answer 189 views
1 answer 184 views
184 views asked May 5, 2018 by avibootz
...