1. Why not just write cin>> str; instead of lines 27-30 inc?
2. Try also checkPalindrome( str ); at line 36?
:-)
after doing that even the 5 character word is not working….. can tell what is wrong with my checkPalindrome code ?
Show us your code. I am runningyour code successfully on codeblocks for all sorts of lengths including 5.
PS with the couple of small changes I suggested. (Of course.)
PPS I didn't check your function logic because it worked. I'm lazy. But if it aint broken ...
Last edited on
Ohh yes its running fine ..!?!! thanks!
is there some way so that i can prevent the users from writing more than they entered .That is
if i entered size 2,
I will still be able to write more than 2 characters and the function is checking all of them !
for eg:
size entered : 2;
str entered : abcddcba;
output : is
how can i prevent this …
One way is to accept a full line of text by getline() or whatever and then check that the length of that input complies before proceeding ...
Last edited on