write a recursive method that takes a string as a parameter. it returns a string composed of itself, and a mirror image of itself(reverse), separated by a hyphen. complete this function without the aid of a helper function and without the usage of the string classes reverse method.

Respuesta :

You can use the code below to solve the question about recursive methods:

-------------------

CODE AREA

-------------------

#include <iostream>

using namespace std;

string mirrorString(string s){

if(s.length()==1)return s;

   string word=s.at(s.length()-1)+mirrorString(s.substr(0,s.length()-1));

   return word;

}

int main()

{

 

cout << mirrorString("rahul")<< endl;

cout << mirrorString("Kumar")<< endl;

cout << mirrorString("Chegg")<< endl;

cout << mirrorString("Kundra")<< endl;

  return 0;

}

-------------------

CODE AREA

-------------------

Learn more about recursive method: https://brainly.com/question/22237421

#SPJ4

The Output:

Ver imagen newibra