Question
Use loop, stack, and recursion three different method to reverse the string. It confuses me for a long time, thank you so much! There is
Use loop, stack, and recursion three different method to reverse the string.
It confuses me for a long time, thank you so much!
There is the code I have
#ifndef SMARTREVERSE_H #define SMARTREVERSE_H #include
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include
{ } // return the current value of the private data member: str string smartReverse::getString() const { } // set the value of str to be the passed in parameter input_str void smartReverse::setString(string input_str) { }
// return a reversed string from str // using a loop to implement // Note that str has not been changed string smartReverse::rev() const { } // return a reversed string from str // using recursion to implement // Note that str has not been changed string smartReverse::rev_recursive() const
{ } // return a reversed string from str // using a stack to implement // Note that str has not been changed string smartReverse::rev_stack() const { }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started