lanzhijie525 @ 2022-01-15 23:24:06
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b,c,d,e,f,g,h,i,j,A;
scanf ("%d-%d%d%d-%d%d%d%d%d-%d",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j);
A = ( a + 2*b + 3*c + 4*d + 5*e + 6*f + 7*g + 8*h + 9*i) % 11;//验证码
if ( A == 10 && char (j) == 88 || j==A){
cout << "Right" << endl;
return 0;
}else{
cout << a << "-" << b << c << d << "-" << e << f << g << h << i << "-" ;
if(A==10){
cout<<"X"<<endl;
}
else{
cout<<A<<endl;
}
return 0;
}
return 0;
}```
by ssxvngn @ 2022-01-15 23:26:46
@lanzhijie525 识别码若为 %d
应该不行。
by ssxvngn @ 2022-01-15 23:28:14
@lanzhijie525 我的意思是输入用的scanf("...%d",...j)
应该是%c
吧
by Heptagon18 @ 2022-01-15 23:29:38
输入不能用%d,一位一位地取要用%c再转回int类型
by lanzhijie525 @ 2022-02-09 12:04:10
@一个pupil 好的谢谢