Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cstring>
- using namespace std;
- int main()
- {
- string str;
- cout<<"Enter string: ";
- getline(cin,str);
- cout<<"Input size: "<<str.size()<<endl;
- const char * tstr = str.c_str();
- char rstr[str.size()];
- int j = 0;
- for(int i = str.size()-1 ; i >= 0 ; i--)
- {
- rstr[i] = tstr[j++];
- }
- cout<<"Reverse string: "<<rstr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement