Discover answers to your questions with Westonci.ca, the leading Q&A platform that connects you with knowledgeable experts. Experience the convenience of finding accurate answers to your questions from knowledgeable professionals on our platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.

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.

Sagot :

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:

View image newibra
Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.