已阅读5页,还剩10页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C语言课程设计课程设计报告题 目身份证信息管理软件年级专业2010级电子信息工程完成日期2011年6月17日目 录1. 课程设计目的32. 分析与设计33核心代码清单54. 设计中的问题145. 课程设计总结146. 参考书目141. 课程设计目的:1) 巩固和加深对C语言课程的基本知识的理解和掌握;2) 掌握和提高C语言编程和程序调试的基本能力;3) 利用C语言进行基本的软件设计,并掌握软件开发的基本过程和基本方法以及良好的编程风格;4) 掌握书写程序设计说明书的方法;5) 提高运用C语言解决实际问题的能力。2. 分析与设计:1) 系统需求:公民身份信息是国家最宝贵的基础信息资源之一,是制定与实施各种政策和指导经济建设的重要依据。利用现代信息技术进行公民身份信息资源的充分开发与利用,掌握人口信息的动态变化,对于国家加强社会管理,实现社会信息化将起到积极的推动作用。对于促进社会主义现代化建设和经济体制改革、打击犯罪、方便群众、保护公民的合法权益等都具有十分重要的意义。其建设的最终目标是实现与国家其它有关公民信息的系统实现互连互通,数据高度共享。为建立国家公民个人信用体系,为国家经济建设和社会发展做出贡献。因此,我想设计一个身份证信息管理软件,用于对省份正信息的分类、管理和统计,从而方便公安机关和普通民众的查询。2) 设计思路:应用结构体对身份证信息进行添加、删除、查寻、修改、保存、统计和文件操作等。3) 综合任务:本次训练需要编写一个身份证信息管理系统。此系统可以完成录入身份证信息、查询身份证信息、修改和删除身份证信息;录入信息后可统计相关的(诸如一定年龄段的人数等)信息,并将信息存储在文件中。4) 技术方案: 建立身份证信息结构体链表; 对ID_card文件的打开、输入、关闭等操作; 对 ID_card 文件的读取、查找、统计等操作; 对身份证姓名、年龄、出生年月等校验和正误的判断; 用switch函数控制各子程序的调用; 程序中应用指针、字符串、结构体嵌套、递归、函数调用等知识; 应用库函数strcpy、strcmp、stnrcmp、switch等。开始(欢迎界面)选择所需操作4.寻找信息2.添加信息1.创建新系统3.删除信息5.统计信息选择所需操作 选号符合规定选择所需统计操作选号符合规定选号符合规定按年龄查找按出生日期按姓名查找按年龄段按出生年份结束是是是否否否5) 身份证管理系统的框架图如下所示:6) 测试数据截屏:7) 详细设计说明 结构体:struct ID_card char name20;char sex;char nation10;int year;int month;int day;char addr80;char num;struct ID_card *next; 相关函数:struct ID_card *creat()/*创建新信息函数*/struct ID_card *insert(struct ID_card *head,struct ID_card *name)/*插入信息函数*/struct ID_card *delete(struct ID_card *head,char * num)/*删除信息函数*/struct ID_card *search_birth(struct ID_card *head,int birthyear,int birthmonth,int birthday)/*通过出生日期寻找信息*/struct ID_card *search_age(struct ID_card *head,int now_age)/*通过年龄寻找信息*/struct ID_card *search_name(struct ID_card *head,char s_name20)/* 通过姓名寻找信息*/struct ID_card *count_age(struct ID_card *head,int age_s,int age_e)/*统计某一年龄段的人数*/struct ID_card *count_year(struct ID_card *head,birthyear)/*统计某一年出生的人数*/通过动态分配存储空间,建立链表并存储信息来建立通讯录。3. 核心代码清单:include #include #define LEN sizeof(struct ID_card)#define YEAR 2011struct ID_card char name20;char sex;char nation10; int year;int month;int day;char addr150;char num20;struct ID_card *next;int n;struct ID_card *creat() struct ID_card *head;struct ID_card *p1,*p2;n=0;p1=p2=(struct ID_card *)malloc(LEN);printf(Please input the name:);scanf(%s,&p1-name);printf(nPlease input the sex:);scanf(%s,&p1-sex);printf(nPlease input the nation:);scanf(%s,&p1-nation);printf(nPlease input the birth-year:);scanf(%d,&p1-year);printf(nPlease input the birth-month:);scanf(%d,&p1-month);printf(nPlease input the birthday:);scanf(%d,&p1-day);printf(nPlease input the address:);scanf(%s,&p1-addr);printf(nPlease input the IDcard-number:);scanf(%s,&p1-num);head=NULL;while(p1-name!=0) n=n+1;if(n=1)head=p1;else p2-next=p1;p2=p1;p1=(struct ID_card *)malloc(LEN); printf(Please input the name:); scanf(%s,&p1-name); printf(Please input the sex:); scanf(%c,&p1-sex); printf(Please input the nation:); scanf(%s,&p1-nation); printf(Please input the birth-year:); scanf(%d,&p1-year); printf(Please input the birth-month:); scanf(%d,&p1-month); printf(Please input the birthday:); scanf(%d,&p1-day); printf(Please input the address:); scanf(%s,&p1-addr); printf(Please input the IDcard-number:); scanf(%s,&p1-num);p2-next=NULL;return(head);struct ID_card *insert(struct ID_card *head,struct ID_card *name) struct ID_card *p1,*p2;p1=(struct ID_card *)malloc(LEN);printf(Please input the name:);scanf(%s,&p1-name);printf(Please input the sex:);scanf(%s,&p1-sex);printf(Please input the nation:);scanf(%s,&p1-nation);printf(Please input the birth-year:);scanf(%d,&p1-year);printf(Please input the birth-month:);scanf(%d,&p1-month);printf(Please input the birthday:);scanf(%d,&p1-day);printf(Please input the address:);scanf(%s,&p1-addr);printf(Please input the IDcard-number:);scanf(%s,&p1-num);p2=head;if(head=NULL)head=p1;p1-next=NULL;elsep2-next=p1;p1-next=NULL;return(head);struct ID_card *delete(struct ID_card *head,char num)struct ID_card *p1,*p2;if(head=NULL)printf(The system has no information!n);return(head);p1=head;while(num!=p1-num&p1-next!=NULL)p2=p1;p1=p1-next;if(num=p1-num) if(p1=head)printf(The identity information to be deleted is:n);printf(Name:%snSex:%cnNation:%snBirth:%d nian %d yue %d rinAddress:%snID card number:%sn,p1-name,p1-sex,p1-nation,p1-year,p1-month,p1-day,p1-addr,p1-num);head=p1-next;else p2-next=p1-next;printf(The identity information to be deleted is:n);printf(Name:%snSex:%cnNation:%snBirth:%d nian %d yue %d rinAddress:%snID card number:%sn,p1-name,p1-sex,p1-nation,p1-year,p1-month,p1-day,p1-addr,p1-num);free(p1);else printf(System does not have information on the ID number!n);return(head);struct ID_card *search_age(struct ID_card *head,int now_age)int b_year;struct ID_card *p;b_year=YEAR-now_age;p=head;while(strcmp(p-year,b_year)!=0&p-next!=NULL)p=p-next;if(strcmp(p-year,b_year)=0)printf(Name:%snSex:%cnNation:%snBirth:%d nian %d yue %d rinAddress:%snID card number:%sn,p-name,p-sex,p-nation,p-year,p-month,p-day,p-addr,p-num);if(p-year!=b_year&p-next=NULL)printf(System does not have information about the age!n); return(head);struct ID_card *search_name(struct ID_card *head,char s_name20)struct ID_card *p;p=head;while(strcmp(p-name,s_name)!=0&p-next!=NULL)p=p-next;if(strcmp(p-name,s_name)=0)printf(Name:%snSex:%cnNation:%snBirth:%d nian %d yue %d rinAddress:%snID card number:%sn,p-name,p-sex,p-nation,p-year,p-month,p-day,p-addr,p-num);if(p-name!=s_name&p-next=NULL)printf(System does not have information about the name!n); return(head);void main()struct ID_card *head,*name; int birthyear,birthmonth,birthday,now_age,age_s,age_e; char num20,s_name20;int a,b,c;printf(*n);printf( Welcome to ID information management software!n);printf(*n);printf(Please select your operating:n);printf(1.Creat a new ID card information system.n);printf(2.Insert the information in the system.n);printf(3.Delete information in the system.n);printf(4.Search ID card information.n);printf(5.For statistical operations.n);scanf(%d,&a);printf(n);switch(a)case 1:head=creat();break;case 2:head=insert(head,name);break;case 3:printf(Please enter the ID number to delete:);scanf(%s,num); head=delete(head,* num);break;break;case 4:printf(Please select the operation you need to searchn);printf(1.Search by date of birthn);printf(2.Search by agen);printf(3.Search by Namen);scanf(%d,&b);printf(n);switch(b)case 2:printf(Please input the age of the person looking for information:);scanf(%d,&now_age);printf(n);search_age(head,now_age);break;case 3:printf(nPlease input the name of the person looking for information:);scanf(%s,s_name);printf(n);search_name(head,s_name);break;default:printf(Your operating errors!n);break;case 5:printf(Please enter the statistics you need to operate:n);printf(1.Statistics of a number of age.n);printf(2.Statistics the number of births in a year.n);scanf(%d,&c);printf(n);default:printf(Your operating errors!n);printf(Thank you for your visit!n);4. 设计中的问题:由于链表的创建和文件操作上的课较少,加之程序设计时间较紧,上述源程序还有很多不完善之处。上述原代码中,struct ID_card *count_year(struct ID_card *head,birthyear),struct ID_card *count_age(struct ID_card *head,int age_s,int age_e),struct ID_card *search_birth(str
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 祭十二郎文 韩愈教学设计高中语文人教版选修中国古代诗歌散文欣赏 -人教版
- 第四节 首都北京教学设计初中地理商务星球版八年级下册-商务星球版2012
- 第九课 小猫顶足球-侦测与机会指令教学设计初中信息技术大连版2015七年级下册-大连版2015
- 2026海南乐东黎族自治县第二人民医院医共体编外专业技术人员招聘39人笔试备考题库及答案解析
- 2026年合肥市庐阳区公益性岗位人员公开招聘42名笔试备考题库及答案解析
- 2026四川宜宾市屏山县农民工服务中心招募就业见习人员1人考试备考题库及答案解析
- 2026北京市大兴区魏善庄镇镇属企业招聘1人笔试模拟试题及答案解析
- 2026湖南马栏山集团有限公司春季校园招聘5人考试模拟试题及答案解析
- 2026南开大学人事处部分科研助理岗位招聘考试参考题库及答案解析
- 甲基丙二酸血症诊疗规范考试试卷试题及参考答案
- 2022年上海市闵行区七宝镇社区工作者招聘考试真题及答案
- GB/T 17702-2021电力电子电容器
- 量子力学-81电子自旋态与自旋算符
- DV-PV培训课件:设计验证和生产确认
- 数模和模数转换器-课件
- 小学生血液知识讲座课件
- 部编人教版中考语文试卷分类汇编口语交际与综合性学习
- 钢结构安装专项施工方案(普通钢结构)
- 99S203 消防水泵接合器安装图集
- 路面施工技术全套课件
- DBJ50T-065-2020 民用建筑外门窗应用技术标准
评论
0/150
提交评论