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 program that prompts the user to input a positive integer. It should then print the multiplication table of that number.

SCHOLARSHIP

DNF sorting ( 0s , 1s , 2s, sorting )