#include <stdio.h>
int main(){
char a[100][19];
int n;
int i,j;
int sum;
int b[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
char c[11]={'1','0','X','9','8','7','6','5','4','3','2'};
int flag=1;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s", a[i]);
for(i=0;i<n;i++){
sum=0;
for(j=0;j<17 && a[i][j]-'0'>=0 && a[i][j]-'0'<=9 ;j++){
sum+=b[j]*(a[i][j]-'0');
}
if(j!=17 || a[i][17]!=c[sum%11]){
flag=0;
printf("%s\n", a[i]);//输出有问题的字符串
}
}
if(flag==1)
printf("All passed");
return 0;
}
scanf那里的a[i]是什么意思?a已经定义成二维数组了,是省略了行长度吗?默认行长度是0?
qq_小朱
xx_王大可_959153784511