一个神奇的东西。。输入身份证号除了最后一位,它会把你的身份证号完整输出。
#include
using namespace std;
int main()
{
int xs[17]={7, 9, 10 ,5 ,8 ,4 ,2 ,1, 6, 3, 7, 9 ,10, 5, 8, 4, 2 };
int result[]={1, 0 ,-1 ,9, 8 ,7, 6 ,5 ,4 ,3, 2};
long long x,f;
int t,sum,fag,i;
while(cin>>x)
{
f=x;
sum=0;
i=17;
while(i--)
{
t=x%10;
x=x/10;
sum+=xs[i]*t;
}
fag=result[sum%11];
if(fag==-1)
cout<<"ID CARD "<