Can someone tell me how to at least start correcting my program?? I submitted to instructor for review and his response was:
Your reverse routine is correct.
The only problem is that you reversed the copy (reverse) of cstring, not cstring itself.
Please reverse the characters in the cstring.
Make result point to the first character of cstring
Make swapper point to the last character of cstring
Then you use while statement as it is EXCEPT the while condition
In this case, the correct while condition should be (result<=swapper)
while(result <= swapper) // please check carefully whether it should be <= or <.
{
swapper--;
*result = *swapper;
result++;
}
Your code is wrong because you simply overwrite characters pointed by result by characters pointed by swapper. You shoud apply swapping not overwritting.
Thanks so much, that works, but I only get the first three characters in reverse order for the cout??? I know I am doing something wrong, just don't know how to fix it...