Function that reverses a string?

Oct 12, 2012 at 12:29am
Basically I'm supposed to write a program that computes the reverse of a string. for example the word "flow" would be "wolf". the book says to to start at the second characted and reverse the string from there adding the first character to the end, but I have no idea how to even start. Can somebody help?
Oct 12, 2012 at 12:53am
C++ has the function reverse(), so normally you wouldn't need to do anything to individual characters.
It would be nice if you wrote more about the proposed algorithm, perhaps it's something along the lines of
return my_reverse(str.substr(1)) + str[0];? What is this part of the book talking about?
Last edited on Oct 12, 2012 at 12:54am
Topic archived. No new replies allowed.