题目:
#include<iostream>
#include<string>
using namespace std;
int mp[10] = { 10,9,8,7,6,5,4,3,2 };
int main() {
string str;
cin >> str;
int cnt = 0,x=0;
for (int i = 0; i < str.length(); i++) {
if (str[i] >= '0'&&str[i] <= '9') {
x += (str[i] - '0')*mp[cnt++];
}
cout << str[i];
}
x =11 - x % 11;
if (x >= 1 && x <= 9)
cout << '-' << x;
else if (x == 10)
cout << '-' << 'X';
else if (x == 11)
cout << '-' << '0';
system("pause");
return 0;
}