Advertisement
Guest User

LabExer6Prog1.1

a guest
May 26th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. void reverser(string x);
  5.  
  6. int main()
  7. {
  8. string a;
  9. cout << "Enter a string : ";
  10. cin >> a;
  11. cout << "Reversed string: ";
  12. reverser(a);
  13. system("pause>0");
  14. }
  15.  
  16. void reverser(string x)
  17. {
  18. if (x.length() == 0)
  19. return;
  20. else
  21. {
  22. reverser(x.substr(1));
  23. cout << x[0];
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement