#include <iostream>
#define endl '\n'
using namespace std;
int main(){
char x;
short int a[9],n,sum=0,i;
while(cin>>x){
for(i=0;i<9;i++) cin>>a[i];
switch (x){
case 'A' ... 'H':
n=x-'A'+10;
break;
case 'J' ... 'N':
n=x-'J'+18;
break;
case 'P' ... 'V':
n=x-'P'+23;
break;
case 'I':
n=34;
break;
case 'O':
n=35;
break;
case 'W':
n=32;
break;
case 'X':
n=30;
break;
case 'Y':
n=31;
break;
case 'Z':
n=33;
break;
}
sum+=(n%10)*9+n/10+a[8];
for(i=0;i<8;i++) sum+=a[i]*(8-i);
if(sum%10==0) cout<<"real"<<endl;
else cout<<"fake"<<endl;
cout<<n;
}
}
char a[9];
sum+=(n%10)*9+n/10+a[8]-'0';
for(i=0;i<8;i++) sum+=(a[i]-'0')*(8-i);
然後記得sum要初始化