I need help with this code, I am trying to output yes when the reversed of the string is the same as original and no if it's not, every time I run the code even if the reversed is the same it outputs no.
The best I can think of right now is that you are trying assign a single char to a string which leaves "letter2" blank and that is why your if condition is always false because it is comparing a blank string to one with something in it.
I have not figured out how to fix what you have yet, but you could replace the for loop with:
Your reverse function will not reverse a string. Every time you go through the loop you are assigning a new letter to letter2. You need to be adding a letter on to letter2 (you will need to use a +). An easier way to do it though would be reverse(letter2.begin(), letter2.end());. Assign letter2 = letter; then the reverse function. You may need to #include <algorithm>