@FurryGuy: wow! Thanks a lot for showing me the different ways on how to make this task.
1st version
I simply can not believe that I have been using the wrong library, it should be obvious for me since I was trying the
strlen()
command and my compiler showed the message:
palindromo.cpp:15:27: error: ‘strlen’ was not declared in this scope |
. On the 22nd line where you added:
reves[tam] = '\0'; // have to null terminate the string, as the original was |
Can you refer me some info on the logic of this?
2nd version
Wow! Just classy, very classy. Very trimmed logic have to practice more for achieving a similar level.
@mrlowkey941: Thanks for your help. I still don't grasp the logic on using this cycle beginning at the 24th line:
for(int i = size - 1; i >= 0; i--){
cout << palindro[i];
} |
Does this code prints one element of the string at the time?
Thanks a lot to both of you for your time. I'm marking this post as solved. You can PM me if you wish to help me with this other questions that originated from the original post.