Write a program to reverse the string. input = google output = elgoole */
#include<iostream>
#include<string>
using namespace std;
void rvrsstr(string a)//rvrsstr=reverse string:user function
{ if(a.size()==0)
{return;}
rvrsstr(a.substr(1));
cout<<a[0];
}
int main()
{ string a;
a="google";
rvrsstr(a);
return 0;
}
Comments
Post a Comment
If you have any doubt ,let me know