Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void reverser(string x);
- int main()
- {
- string a;
- cout << "Enter a string : ";
- cin >> a;
- cout << "Reversed string: ";
- reverser(a);
- system("pause>0");
- }
- void reverser(string x)
- {
- if (x.length() == 0)
- return;
- else
- {
- reverser(x.substr(1));
- cout << x[0];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement