c语言课程设计学生成绩以及基本信息系统

上传人:龙*** 文档编号:140171437 上传时间:2020-07-27 格式:DOCX 页数:15 大小:21.65KB
返回 下载 相关 举报
c语言课程设计学生成绩以及基本信息系统_第1页
第1页 / 共15页
c语言课程设计学生成绩以及基本信息系统_第2页
第2页 / 共15页
c语言课程设计学生成绩以及基本信息系统_第3页
第3页 / 共15页
c语言课程设计学生成绩以及基本信息系统_第4页
第4页 / 共15页
c语言课程设计学生成绩以及基本信息系统_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《c语言课程设计学生成绩以及基本信息系统》由会员分享,可在线阅读,更多相关《c语言课程设计学生成绩以及基本信息系统(15页珍藏版)》请在金锄头文库上搜索。

1、#include #include #include struct student long num; char name12; char phone11; char city12; char postal6; struct student *next ; ;long num1,numm;char name112,namee12,phone111,city112,cityy12,postal16; typedef struct student *stu;FILE *fp;int n,i=0,w;char ch;int code () long a; printf(tt请输入密码:(你还有2次机

2、会)); scanf(%d,&a); if(a=123) printf(轻敲任意键继续);getch(); return 1; else printf(tt请重新输入密码:(还有1次机会)); scanf(%d,&a); if(a=123) printf(轻敲回车键继续); return 1; else return 0; int menu() printf(+-请选择:-+n); printf(+-1.录入个人通讯信息:-+n); printf(+-2.查找个人通讯信息:-+n); printf(+-3.删除个人通讯信息:-+n); printf(+-4.更改个人通讯信息:-+n); pri

3、ntf(+-5.添加个人通讯信息:-+n); printf(+-6.显示功能:+n); printf(+-7.将已写的数据存入文件中-+n); printf(+-8.读出已经存储的文件信息-+n); printf(+-0.退出客户端-+n); scanf(%s,&ch); return ch; /第1个功能的实现: struct student *p() struct student *head,*p1,*p2; n=0; p1=p2=(stu)malloc(sizeof(struct student ); head=NULL; system(cls); printf(以学号为000结束。n)

4、; while(1) printf(请输入学生的基本信息:学号、姓名、电话、城市、邮编n); scanf(%d,&p1-num); if(p1-num=000) break; scanf(%s %s %s %s,p1-name,p1-phone,p1-city,p1-postal); n=n+1; if(n=1) head=p1; else p2-next=p1; p2=p1; p1=(stu)malloc(sizeof(struct student ); p2-next=NULL; return (head);/第2个查找的功能的实现: void s(stu head);void s1(st

5、u head)/1、用学号来查找信息。 stu p1; int j=0; p1=(stu)malloc(sizeof(struct student ); printf(请输入要查找学生的学号:n); scanf(%ld,&num1); p1=head; while(p1!=NULL) if(p1-num=num1) j=1; printf(学号:%d 姓名:%s 电话:%s 城市:%s 邮编:%sn,p1-num,p1-name,p1-phone,p1-city,p1-postal); break;p1=p1-next; if(j=0)printf(没有找到你要查找学生的信息。n); else

6、printf(这是你要查找学生的信息:n); system(pause); s(head); void s2(stu head) stu p1; int j=0; p1=(stu)malloc(sizeof(struct student); printf(请输入要查找学生的姓名:n); scanf(%s,name1); p1=head; while(p1!=NULL) if(strcmp(p1-name,name1)=0) j=1; printf(学号:%d 姓名:%s 电话:%s 城市:%s 邮编:%sn,p1-num,p1-name,p1-phone,p1-city,p1-postal);

7、p1=p1-next; if(j=0)printf(sorry 没有找到你要查找学生的信息。n); elseprintf(你看,这是你想要的信息吗?n); system(pause); s(head); void s3(stu head) stu p1; int j=0; p1=(stu)malloc(sizeof(struct student ); printf(请输入要查找学生的城市:n); scanf(%s,city1); p1=head; while(p1!=NULL) if(strcmp(p1-city,city1)=0) j=1;printf(学号:%d 姓名:%s 电话:%s 城

8、市:%s 邮编:%sn,p1-num,p1-name,p1-phone,p1-city,p1-postal); p1=p1-next; if(j=0) printf(sorry 没有找到你要查找学生的信息n); else printf(这是你要查找学生的信息吗?n); system(pause); s(head); void s(stu head) system(cls); printf(*请输入你想查找的方式*n); printf(* 1.以学号查找 *n); printf(* 2.以姓名查找 *n); printf(* 3.以城市查找 *n); printf(* 4.返回 *n); sca

9、nf(%d,&w); switch(w) case 1:s1(head);break; case 2:s2(head);break; case 3:s3(head);break; case 4:menu();break; default:printf(你的输入有错,请重新输入n);system(pause);s(head); /用学生学号方尺删除:stu delet(stu head); void delete1(stu head) stu p1,p2; int j=0; p2=p1=(stu )malloc(sizeof(struct student); printf(请输入要删除学生的学号

10、:n); scanf(%d,&num1); p2=p1=head; if(head-num=num1&head!=NULL) head=head-next; free(p1); i-; j=1; else p1=head-next; if(p1!=NULL) while(p1-num!=num1) p2=p1; p1=p1-next; p2-next=p1-next; free(p1); i-; j=1; if(j=0) printf(此通讯信息不存在,删除的失败!n); else printf(删除成功!n); system(pause); delet(head);/*用学生姓名的方尺查找*/ void delete2(stu head)stu p1,p2;int j=0; printf(请输入要删除学生的姓名:n); scanf(%s,name1); p2=p1=head; if(head!=NULL&(strcmp(head-name,name1)=0) head=head-next; free(p1); i-; j=1; else p1=head-next;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 职业教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号