# Re: 徵求 check 身分证 id 的方法

Posted by 小顺子 on July 16, 1998 at 15:08:51:

In Reply to: 徵求 check 身分证 id 的方法 posted by 阿忠 on July 15, 1998 at 17:38:35:

: 徵求 check 身分证 id 的方法
: 因我有两种方式但却不一样!
: 不知那位高手一定正确的 check 身分证 id 的方法
: thank!!

如果要【正确】，建议到内政部的网站查查看．．．但我没试过．．
另外提供【清朝出土文献一则】，希望你用得上．．． ^_^（别骂我．．）

2 CLS : COLOR 15, 1: PRINT " 身分证号码检查程式 "
3 COLOR 11, 0: INPUT "请输入身份证号码：", NUMBER$: COLOR 15, 0
10 A$ = MID$(NUMBER$, 1, 1)
11 B$ = MID$(NUMBER$, 2, 1)
12 C$ = MID$(NUMBER$, 3, 1)
13 D$ = MID$(NUMBER$, 4, 1)
14 E$ = MID$(NUMBER$, 5, 1)
15 F$ = MID$(NUMBER$, 6, 1)
16 G$ = MID$(NUMBER$, 7, 1)
17 H$ = MID$(NUMBER$, 8, 1)
18 I$ = MID$(NUMBER$, 9, 1)
19 J$ = MID$(NUMBER$, 10, 1)
20 IF LEN(NUMBER$) = 10 THEN 50 ELSE 21
21 PRINT "□ 身份证号码输入错误!": END
50 IF ASC(A$) >= 65 AND ASC(A$) <= 90 THEN 60 ELSE 51
51 PRINT "□ 第一位数英文字母需大写字母": END
60 IF VAL(B$) = 1 OR 2 THEN 61 ELSE 21
61 IF VAL(C$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 62 ELSE 21
62 IF VAL(D$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 63 ELSE 21
63 IF VAL(E$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 64 ELSE 21
64 IF VAL(F$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 65 ELSE 21
65 IF VAL(G$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 66 ELSE 21
66 IF VAL(H$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 67 ELSE 21
67 IF VAL(I$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 68 ELSE 21
68 IF VAL(J$) = 1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 0 THEN 70 ELSE 21
70 IF A$ = "A" THEN AA = 1 + 0 * 9
71 IF A$ = "B" THEN AA = 1 + 1 * 9
72 IF A$ = "C" THEN AA = 1 + 2 * 9
73 IF A$ = "D" THEN AA = 1 + 3 * 9
74 IF A$ = "E" THEN AA = 1 + 4 * 9
75 IF A$ = "F" THEN AA = 1 + 5 * 9
76 IF A$ = "G" THEN AA = 1 + 6 * 9
77 IF A$ = "H" THEN AA = 1 + 7 * 9
78 IF A$ = "I" THEN AA = 3 + 4 * 9
79 IF A$ = "J" THEN AA = 1 + 8 * 9
80 IF A$ = "K" THEN AA = 1 + 9 * 9
81 IF A$ = "L" THEN AA = 2 + 0 * 9
82 IF A$ = "M" THEN AA = 2 + 1 * 9
83 IF A$ = "N" THEN AA = 2 + 2 * 9
84 IF A$ = "O" THEN AA = 3 + 5 * 9
85 IF A$ = "P" THEN AA = 2 + 3 * 9
86 IF A$ = "Q" THEN AA = 2 + 4 * 9
87 IF A$ = "R" THEN AA = 2 + 5 * 9
88 IF A$ = "S" THEN AA = 2 + 6 * 9
89 IF A$ = "T" THEN AA = 2 + 7 * 9
90 IF A$ = "U" THEN AA = 2 + 8 * 9
91 IF A$ = "V" THEN AA = 2 + 9 * 9
92 IF A$ = "W" THEN AA = 3 + 0 * 9
93 IF A$ = "X" THEN AA = 3 + 1 * 9
94 IF A$ = "Y" THEN AA = 3 + 2 * 9
95 IF A$ = "Z" THEN AA = 3 + 3 * 9
101 B = VAL(B$): C = VAL(C$): D = VAL(D$): E = VAL(E$): F = VAL(F$): G = VAL(G$): H = VAL(H$): I = VAL(I$): J = VAL(J$)
102 B = B * 8
103 C = C * 7
104 D = D * 6
105 E = E * 5
106 F = F * 4
107 G = G * 3
108 H = H * 2
109 I = I * 1
110 J = J * 1
112 TOTAL = AA + B + C + D + E + F + G + H + I + J
113 IF TOTAL MOD 10 = 0 THEN 114 ELSE 21
114 PRINT "□ 身份证号码正确!"

Follow Ups: