jor蛋 @ 2021-07-09 21:18:03
#include<stdio.h>
#include<ctype.h>
int zhuan(char c){
int f,m;
m=toascii(c);
f=m-48;
return f;
}
int main(){
int i,sum,j;
char a[15];
for(i=1;i<=13;i++){
scanf("%c",&a[i]);
}
j=0;
for(i=1;i<=11;i++){
if(i!=2&&i!=6)
j=j+1;
if(toascii(a[i])>47&&toascii(a[i])<58)
sum=sum+zhuan(a[i])*j;
}
if(sum%11==10){
if(88==toascii(a[13]))
printf("Right");
else{
for(i=1;i<=12;i++){
printf("%c",a[i]);
}
printf("X");
}
}
else{
if(sum%11==zhuan(a[13]))
printf("Right");
else{
for(i=1;i<=12;i++){
printf("%c",a[i]);
}
printf("%d",sum%11);
}
}
}
by ud2_ @ 2021-07-09 21:20:11
main.c: In function 'main':
main.c:20:16: warning: 'sum' may be used uninitialized in this function [-Wmaybe-uninitialized]
20 | sum=sum+zhuan(a[i])*j;
| ~~~^~~~~~~~~~~~~~~~~~
by jor蛋 @ 2021-07-09 21:23:23
@ud2_ 竟然是单纯的没初始化!!!?