找传奇、传世资源到传世资源站!

C# 身份证号码最后一位计算方法

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

C# 身份证号码最后一位计算方法 常用C#方法-第1张using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 身份证号码最后一位计算方法{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { } private void buttonX1_Click(object sender, EventArgs e) { string sfzmhm_17 = textBoxX1.Text.ToString(); char[] c = sfzmhm_17.ToCharArray(); if (sfzmhm_17.Length != 17) { MessageBox.Show("身份证号码位数不对!"); return; } else { int xx = (int.Parse(c[0].ToString()) * 7) (int.Parse(c[1].ToString()) * 9) (int.Parse(c[2].ToString()) * 10) (int.Parse(c[3].ToString()) * 5) (int.Parse(c[4].ToString()) * 8) (int.Parse(c[5].ToString()) * 4) (int.Parse(c[6].ToString()) * 2) (int.Parse(c[7].ToString()) * 1) (int.Parse(c[8].ToString()) * 6) (int.Parse(c[9].ToString()) * 3) (int.Parse(c[10].ToString()) * 7) (int.Parse(c[11].ToString()) * 9) (int.Parse(c[12].ToString()) * 10) (int.Parse(c[13].ToString()) * 5) (int.Parse(c[14].ToString()) * 8) (int.Parse(c[15].ToString()) * 4) (int.Parse(c[16].ToString()) * 2); int ys = xx % 11; switch (ys) { case 0: textBoxX2.Text = "1"; break; case 1: textBoxX2.Text = "0"; break; case 2: textBoxX2.Text = "X"; break; case 3: textBoxX2.Text = "9"; break; case 4: textBoxX2.Text = "8"; break; case 5: textBoxX2.Text = "7"; break; case 6: textBoxX2.Text = "6"; break; case 7: textBoxX2.Text = "5"; break; case 8: textBoxX2.Text = "4"; break; case 9: textBoxX2.Text = "3"; break; case 10: textBoxX2.Text = "2"; break; } } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复