what wrong with the program?why i can not run!!~~ emergency!!~~~
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253`` ``````#include #include #include using namespace std; int main() { string str1; string str2; bool pldm=false; int size; cout<<"enter string: "<0;b--) { str2=str2.append(str1[b],1); } for(int c=size;c>0;c--) { if(str1[c]==str2[c]) { pldm=true; } else pldm=false; } if(pldm) { cout<<"it is palindroma"<
Last edited on
That's a very unusual algorithm. It might help if you described the algorithm in words, then implement that algorithm once you're convinced it's correct.

If you had a pen and paper, how would you do it?
Hi DingDong,

Creating a Algorithm for Palindrome is very easy. I am, not going to give a code snippet nor any pointers about this, I will only say read the Book or read the chapter again until you grasp the concept.
Use Pen & Paper first before you start typing away!

Thanks,
SpaceWorm
for(int b=size;b>0;b--)
{

str2=str2.append(str1.[b],1);
}
here is the error
and u cannot use [] for strings
use
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556`` ``````#include #include #include using namespace std; int main() { string str1; string str2; bool pldm=false; int size; cout<<"enter string: "<0;b--) { str2=str2.append(str1.at(b),1); } //////////////// for(int c=size;c>0;c--) { if(str1.at(c)==str2.at(c)) { pldm=true; } else pldm=false; } if(pldm) { cout<<"it is palindroma"<