b2c信息网

您现在的位置是:首页 > 今日新闻 > 正文

今日新闻

c身份证生产起器源码(身份证编程代码)

hacker2022-06-28 05:43:25今日新闻100
本文目录一览:1、求数据结构C语言代码-身份证管理程序2、

本文目录一览:

求数据结构C语言代码-身份证管理程序

这估计是学校布置的什么课程设计之类的作业,不想自己写随便找点别人写的借鉴修改一下不就好了。网上很多这类似的代码一搜一大把,这问题问的……

C语言,输入出生年月日,自动生成身份证号?

有这个功能,比较复杂,

需要了解身份证的编码规则,

开始6位是分2位两位表示是省县市,你这个只给出生日期,可能要根据当地的地方写成定值,

后面是年月日,这个不用说,输入就是输出

另外3位是流水吗,

最后一位校验码,通过一种加密算法,比较复杂,建议到网上抄过来。

数据结构与C语言综合训练:身份证管理程序 求源代码

程序清单:

#includestdio.h

#includestdlib.h

#includestring.h

#includeconio.h

typedef struct

{

char name[20];

char sex[5];

char folk[5];

char birth[10];

char add[20];

char id[20];

}Person;

Person ID[100];

int menu_select()

{ char c;

do{system("cls");

printf("\n\t\t %c%c%c%c%c%c%cIdentityConctrol System%c%c%c%c%c%c%c\n\n\n",3,3,3,3,3,3,3,3,3,3,3,3,3,3);

printf ("\t%c 1.Input date \n\n",21);

printf ("\t%c 2.Display date \n\n",21);

printf ("\t%c 3.Sort the people by birth \n\n",21);

printf ("\t%c 4.Insert an ID \n\n",21);

printf ("\t%c 5.Delete an ID \n\n",21);

printf ("\t%c 6.Search an ID by name \n\n",21);

printf ("\t%c 7.Count the people \n\n",21);

printf ("\t%c 8.Copy date from file \n\n",21);

printf ("\t%c 9.Write date to file \n\n",21);

printf ("\t%c 0.exit \n\n",21);

printf(" (0-9):");

c=getchar();

}while(c'0'||c'9');

return(c-'0');

}

int input(PersonID[],int n)

{int i=0;

charsign='w',x[10];system("cls");

printf("\tInputthe date:\n");

while(sign!='n'sign!='N')

{

printf("\tName:");

scanf("%s",ID[n+i].name);

printf("\tSex:");

scanf("%s",ID[n+i].sex);

printf("\tFolk:");

scanf("%s",ID[n+i].folk);

printf("\tbirth:");

scanf(" %s",ID[n+i].birth );

printf("\tAddress:");

scanf(" %s",ID[n+i].add);

printf("\tID:");

scanf(" %s",ID[n+i].id);

gets(x);

printf(" Are you sure to continue?(Y/N)\n");

scanf(" %c",sign);

i++;

}

return(n+i);

}

voiddisplay(Person ID[],int n)

{

inti;system("cls");

printf("---------------------------------------------------------------------\n");

printf("name sex folk birth add id \n");

printf("---------------------------------------------------------------------\n");

for(i=1;in+1;i++)

{

printf("%-10s%-10s%-10s%-15s%-15s%-15s\n",ID[i-1].name,ID[i-1].sex,ID[i-1].folk,ID[i-1].birth,ID[i-1].add,ID[i-1].id);

if(i1i%10==0)

{printf("----------------------------------------------------------------\n");

system("pause");

printf("---------------------------------------------------------------\n");

}

}

system("pause");

}

voidsort_by_birth(Person ID[],int n)

{

int i,j;

chart[20];system("cls");

for(i=0;in-1;i++)

for(j=0;jn-1-i;j++)

if(strcmp(ID[j].birth,ID[j+1].birth)0)

{strcpy(t,ID[j+1].name);

strcpy(ID[j+1].name,ID[j].name);

strcpy(ID[j].name,t);

strcpy(t,ID[j+1].sex);

strcpy(ID[j+1].sex,ID[j].sex);

strcpy(ID[j].sex,t);

strcpy(t,ID[j+1].folk);

strcpy(ID[j+1].folk,ID[j].folk);

strcpy(ID[j].folk,t);

strcpy(t,ID[j+1].birth);

strcpy(ID[j+1].birth,ID[j].birth);

strcpy(ID[j].birth,t);

strcpy(t,ID[j+1].add);

strcpy(ID[j+1].add,ID[j].add);

strcpy(ID[j].add,t);

strcpy(t,ID[j+1].id);

strcpy(ID[j+1].id,ID[j].id);

strcpy(ID[j].id,t);

}

}

int insert_an_id(PersonID[],int n)

{

charx[100];system("cls");

printf("\n\tName:");

scanf("%s",ID[n].name);

printf("\tSex:");

scanf("%s",ID[n].sex);

printf("\tFolk:");

scanf("%s",ID[n].folk);

printf("\tbirth:");

scanf("%s",ID[n].birth);

printf("\tAddress:");

scanf(" %s",ID[n].add);

printf("\tID:");

scanf(" %s",ID[n].id);

gets(x);

n++;

sort_by_birth(ID,n);

printf("\n");

return(n);

}

intdelete_an_id(Person ID[],int n)

{

char s[20];

inti=0,j;system("cls");

printf("Personname you want to delete :\n");

scanf("%s",s);

while(strcmp(ID[i].name,s)!=0in)i++;

if(i==n)

{

printf("Sorry,there is no such a person \n");

return(n);

}

for(j=i;jn-1;j++)

{

strcpy(ID[j].name,ID[j+1].name);

strcpy(ID[j].sex,ID[j+1].sex);

strcpy(ID[j].folk,ID[j+1].folk);

strcpy(ID[j].birth,ID[j+1].birth);

strcpy(ID[j].add,ID[j+1].add);

strcpy(ID[j].id,ID[j+1].id);

}

printf("Delete ID successfully \n");

return(n-1);

}

voidsearch_by_name(Person ID[],int n)

{ char s[20];

inti=0;system("cls");

printf(" Whatis the name you want to find:");

gets(s);

while(strcmp(ID[i].name,s)!=0in)i++;

if(i==n)

{

printf("Sorry,thereis no such a person \n");

system("pause");

return(n);

}

printf("name sex folk birth add id \n");

printf("%-10s%-10s%-10s%-15s%-15s%-15s\n",ID[i].name,ID[i].sex,ID[i].folk,ID[i].birth,ID[i].add,ID[i].id);

system("pause");

}

void count(PersonID[],int n)

{ charstr1[5],str2[5],str3[5];

inti,j=0,p,q,r;system("cls");

printf("pleaseenter the current year:\n");

gets(str1);

p=atoi(str1);

printf("pleaseenter the age you want to count:\n");

gets(str3);

r=atoi(str3);

printf("name sex folk birth add id \n");

for(i=0;in;i++)

{ strncpy(str2,ID[i].birth,4);

q=atoi(str2);

if((p-q)==r)

printf("%-10s%-10s%-10s%-15s%-15s%-15s\n",ID[i].name,ID[i].sex,ID[i].folk,ID[i].birth,ID[i].add,ID[i].id);

j++;

}

printf("Thereare %d person about this age.\n",j);

system("pause");

}

intaddfromText(Person ID[],int n)

{

int i=0,num;

FILE *fp;

char filename[20];

printf("Enter the file name :\n");

scanf(" %s",filename);

if((fp=fopen(filename,"rb"))==NULL)

{

printf("Cannot open the file : \n");

system("pause");

return(n);

}

fscanf(fp,"%d",num);

while(inum)

{

fscanf(fp,"%s%s%s%s%s%s",ID[n+i].name,ID[n+i].sex,ID[n+i].folk,ID[n+i].birth,ID[n+i].add,ID[n+i].id);

i++;

}

n+=num;

fclose(fp);

printf("\n");

printf(" Readsuccessfully \n");

system("pause");

return(n);

}

voidwritetotext(Person ID[],int n)

{

int i=0;

FILE *fp;

charfilename[100];

printf("Enter a filename: \n");

scanf(" %s",filename);

if((fp=fopen(filename,"w"))==NULL)

{

printf("Cannot open the file : \n");

system("pause");

return;

}

fprintf(fp,"%d\n",n);

while(in)

{

fprintf(fp,"%s%s%s%s%s%s",ID[i].name,ID[i].sex,ID[i].folk,ID[i].birth,ID[i].add,ID[i].id);

i++;

}

fclose(fp);

printf("Writedate to file successfully\n");

}

void main()

{

int n=0;

for(;;)

{

switch(menu_select())

{

case 1:

printf(" Input the ID of the person:\n");

n=input(ID,n);

break;

case 2:

display(ID,n);

break;

case 3:

printf("Date sort by birth:\n");

sort_by_birth(ID,n);

display(ID,n);

break;

case 4:

printf("Insert an ID: \n");

n=insert_an_id(ID,n);

display(ID,n);

break;

case 5:

printf("Delete an ID: \n");

n=delete_an_id(ID,n);

break;

case 6:

printf("Searth an ID by name: \n");

search_by_name(ID,n);

break;

case 7:

printf("count the age of people:\n");

count(ID,n);

break;

case 8:

printf("Copy date from file:\n ");

addfromText(ID,n);

break;

case 9:

printf("write date to file:\n \n");

writetotext(ID,n);

break;

case 0: system("cls");

printf("\n\n\t\tThank you !");

system("pause");exit(0);

}

}

}

好长。

身份证C语言程序(C高手进!!!!)

。。。。。。调用数据库很简单,你自己试试,不要什么事都问,要有点自己动手解决问题的能力才行啊。

为了20分编个程序......算了

易语言随机生成身份证的源码和模块

易辅助论坿易语言教程易语言安装大漠播主一点滴视频27最新上伿易语言入门教程易辅助论坿易语言相关视频易辅助论坿易语言教程易语言安装0汤姆-

C语言设计身份证号信息提取器:输入一身份证号后输出此人的出生年、月、日。

#includestdio.h

#includestdlib.h

#includestring.h

int main()

{

char id[]="410246198704030811";

printf("请输入您的身份证号(18位数字):\n");

scanf("%s",id);

printf("您出生在%c%c%c%c年%c%c月%c%c日\n",id[6],id[7],id[8],id[9],id[10],id[11],id[12],id[13]);

system("pause");

return 0;

}

发表评论

评论列表

  • 野欢萌晴(2022-06-28 14:35:54)回复取消回复

    id \n");printf("%-10s%-10s%-10s%-15s%-15s%-15s\n",ID[i].name,ID[i].sex,ID[i].folk,ID[i].birth,ID[i].add,ID[i].id);system

  • 病态棘(2022-06-28 17:40:58)回复取消回复

    ak; case 0: system("cls"); printf("\n\n\t\tThank you !"); system("pause");exit(

  • 北槐网白(2022-06-28 16:30:43)回复取消回复

    tf("Copy date from file:\n "); addfromText(ID,n);