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

Popular posts from this blog

Write a c++ program to display numbers which is divisible by 2 as well 3 from 6 to n by using and operator .

Write a program to add natural numbers up to 20 by using for loop in c++ language.

Write a c++ program to display numbers which is divisible by 2 as well 3 from 6 to n by using For loop and if else statement .