#include <iostream>
#include <string.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int n, sum = 0, num = 0;
bool flag = true;
int qz[17] = {
7, 9, 10, 5, 8 ,4,2,1,6,3,7,9,10,5,8,4,2};
char m[11] = {
'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'
};
cin >> n;
cin.get();
char str[20];
while(n--){
cin.getline(str, 20);
sum = 0;
flag = true;
for(int i = 0; i < 17; i++){
if((str[i]-'0'>=0) && (str[i]-'0'<=9)){
sum += ((str[i]-'0')*qz[i]);
}else{
num++;
flag = false;
cout << str << endl;
break;
}
}
if(flag == true){
if(m[sum%11] == str[17]){
}else{
num++;
cout << str << endl;
}
}
}
if(num == 0){
cout << "All passed";
}
return 0;
}
B1031 查验身份证 (15 分)
猜你喜欢
转载自blog.csdn.net/alovelypeach/article/details/114267795
今日推荐
周排行