誰可幫我看看問題在哪
#include <iostream>
#include <stdio.h>
using namespace std;
int p5a(char s[]) { //判斷函式
//在這加入你的程式碼
int l=strlen(s);
int i;
for(i=0;i<l/2;i++){
if(s[i]!=s[strlen(s)-1-i])
return 1<0;
}
return 1>0;
}
int main() { //主程式
char s1[]="12321";
char s2[]="123121";
char s3[]="1DF23cCc32fd1";
cout<<s1<<":"<<p5a(s1)<<endl;
cout<<s2<<":"<<p5a(s2)<<endl;
cout<<s3<<":"<<p5a(s3)<<endl;
system("pause");
return 0;
}
輸出結果:
12321 = 1
123121 =0
1DF23cCc32fd1 = 0
可是正常來說第3行應該要1才對~~幫幫忙~~謝嚕
|