|
|
back to boardplease help !! !! !! !! !! please help !! !! !! !! !! why my program not work ?? #include<iostream.h> //#include<conio.h> // char s[10001]; char s2[10001]; char s3[20002]; int l; //------------------------------------- int L(void); int Pal(int i); int First(void); //------------------------------------- void main(void) { //clrscr(); // int x,i; // cin>>s; // l=L(); x=First(); // //printf("%s",s); for(i=x-1;i>=0;i--) s2[x-1-i]=s[i]; s2[x]=0; for(i=0;i<x;i++) s[l+i]=s2[i]; s[l+x]=0; for(i=0;s[i];i++) s3[i]=s[i]; cout<<s3; // //getch(); } //------------------------------------- int L(void) { int r; // for(r=0;s[r];r++); // return(r); } // int First(void) { int r,flag=1; // r=1; while((flag)&&(r<l)) if(Pal(r)) flag=0; else r++; // return(r); } // int Pal(int i) { int r; // while((r)&&( r<((l+i)/2) )) if(s[r]==s[l-r+i-1]) r++; else r=0; // return(r); } i not see error !! !! Re: please help !! !! !! !! !! Posted by YoD 10 May 2005 18:09 On test: vxabba your program outputs vxabbaabbaxv, but right answer is vxabbaxv Re: please help !! !! !! !! !! thanks for the test! i fixed the bug, but I still WA#4 |
|
|