基于c学生档案管理系统

基于c学生档案管理系统

ID:35623418

大小:15.62 KB

页数:16页

时间:2019-04-03

基于c学生档案管理系统_第1页
基于c学生档案管理系统_第2页
基于c学生档案管理系统_第3页
基于c学生档案管理系统_第4页
基于c学生档案管理系统_第5页
资源描述:

《基于c学生档案管理系统》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、#include#include#include#defineNULL0#defineLEN_ssizeof(structstudent)#defineLEN_csizeof(structcourse)structstudent{charstudent_ID[10];charname[10];chartelephone[12];structstudent*next;};structcourse{charstudent_ID[10];charcourse_ID[10];intscore;structcourse*next;

2、};intscount=0,ccount=0;structstudent*head_s=NULL;structcourse*head_c=NULL;structcourse*add_c(){charstudent_ID[10];charcourse_ID[10];intscore;charcho;structcourse*p1,*p2,*p;do{printf("inputdata:student_ID,course_ID,score");scanf("%s%s%d",student_ID,course_ID,&score);p1=p2=(structcourse*)mal

3、loc(LEN_c);strcpy(p2->student_ID,student_ID);strcpy(p2->course_ID,course_ID);p2->score=score;p2->next=NULL;p1=head_c;if(head_c==NULL){head_c=p2;p2->next=NULL;}else{while((strcmp(p2->student_ID,p1->student_ID)>0)&&(p1->next!=NULL)){p=p1;/*使p指向刚才p1指向的结点*/p1=p1->next;}/*p1后移一个结点*/if(strcmp(p2->

4、student_ID,p1->student_ID)<0){if(head_c==p1)head_c=p2;/*插到原来第一个结点之前*/elsep->next=p2;/*插到p指向的结点之后*/p2->next=p1;}else{p1->next=p2;p2->next=NULL;}}ccount++;getchar();printf("Preaseanykeytocontinue:");printf("按N/n退出");scanf("%c",&cho);}while(cho!='n'&&cho!='N');returnhead_c;}structstudent*add_

5、s(){charstudent_ID[10];charname[10];chartelephone[12];charcho;structstudent*p1,*p2,*p;do{printf("inputdata:student_ID,name,telephone");scanf("%s%s%s",student_ID,name,telephone);p1=p2=(structstudent*)malloc(LEN_s);strcpy(p2->student_ID,student_ID);strcpy(p2->name,name);strcpy(p2->telephone,

6、telephone);p2->next=NULL;p1=head_s;if(head_s==NULL){head_s=p2;p2->next=NULL;}else{while((strcmp(p2->student_ID,p1->student_ID)>0)&&(p1->next!=NULL)){p=p1;/*使p指向刚才p1指向的结点*/p1=p1->next;}/*p1后移一个结点*/if(strcmp(p2->student_ID,p1->student_ID)<0){if(head_s==p1)head_s=p2;/*插到原来第一个结点之前*/elsep->next=p

7、2;/*插到p指向的结点之后*/p2->next=p1;}else{p1->next=p2;p2->next=NULL;}}scount++;getchar();printf("Preaseanykeytocontinue:");printf("按N/n退出");scanf("%c",&cho);}while(cho!='n'&&cho!='N');returnhead_s;}voidprint_s(){structstudent*p;printf("Now,These%drecor

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。