I'm working with the String Class and I'm trying to get my program so that when you inpute a word it will outpute it in reverserse. ie. Test will cout tseT.
I can get it to work for the one word but I need to get it to work for a variety of words. To display each of the letters I use
First = Word.length()-1;
Next = Word.length()-2;
To take the certain letter in a certain position and then
cout << Word.substr(First,Length);
cout << Word.substr(Next,1);
to outpute the last and next letters (t and s).
What I am trying to do is create some sort of a loop that will first output what I have and then subtract one and then output again. I've tried a for loop, do while, and while. They didn't seem to work but I think its just cause I didn't use either of them right. I believe it would be a for loop, but if anyone can help me out and give me some clue on the loop that is all I need. I know where to place it and all.