C语言数据库-学生成绩统计管理系统_第1页
C语言数据库-学生成绩统计管理系统_第2页
C语言数据库-学生成绩统计管理系统_第3页
C语言数据库-学生成绩统计管理系统_第4页
C语言数据库-学生成绩统计管理系统_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、学生成绩统计管理系统C 语言数据结构课程作品 指导老师 : 学生: 学号: 班级:、代码#includestdafx 、h#include#include#include#include#include#include#includestruct gradeint score;struct grade *next;/* 定义成绩的结构 */struct addresschar stu_num4; /* 学号 */ char hname10;/* 性别 */char ename20; /* 姓名 */ char depart30; /* 系别 */ char paddress30; /* 地址

2、*/ char phone13 /* 联系电话 */ ; struct grade *head;struct address *next; ;void loaddata ( struct address *had); void printm ( struct address *head); struct address * seek ( struct address *head);void revise ( structvoid delate ( structvoid saveda ( structvoid addnew ( structaddress *hp); address *head)

3、; address *tou ); address *had );void moveg ( int i, struct grade *move);void gotoxy( int x, int y); void sortp( struct address *head);int main ( void )char ch;int c;struct address *head=NULL; loaddata(&head);dosystem( cls );printf( n );printf( 学生信息与成绩统计 :n );printf( 岳鹏程制作 n );printf( =);n printf( I

4、I Menu:II n);printf( II 1:print all the personal information、II n);printf( I 2:insert some or one person 、I n );printf( I 3:revire someinformation 、I n );printf( I 4:delate some information or a person 、I n );printf(I 5:exit 、I n );printf( =);nprintf( tInput :);doscanf(%d,&c);getchar( ); while (c6);

5、switch ( c )case 1: printm(head);break; case 2: addnew(&head);break; case 3:revise(head); break; case 4: delate(&head); break;break;case 5:return 0; default : break;fflush(stdin););printf( continue or not: input y or nn ch=getchar( ); saveda(head); while (ch=y |ch= Y );return 0;void loaddata ( struc

6、t address *had )FILE *afhead;FILE *gfhead;struct address *p1,*hp1=NULL,*head=NULL;struct grade *p2 , *hp2 = NULL;int i=0;int j=6;if ( !(afhead = fopen( d:information 、dat ,rb )return ;if ( !(gfhead = fopen( d:grade 、dat , rb ) )return ;while (!feof(afhead)p1 = ( struct address *)malloc( sizeof ( str

7、uct address); fread(p1, sizeof ( struct address),1,afhead);if (feof(afhead)if (!p1)free(p1);break ;if (i=0)p1-next = NULL;p1-head = NULL;head = p1;hp1 = p1;i+; /* 使头指针指向第一个创建的节点 */ elsep1-next = NULL;p1-head = NULL;hp1-next = p1;hp1 = hp1-next;*had = head;p1 = *had;/* 成绩就是后进先出 */while (!feof(gfhead)

8、dop2=( struct grade *)malloc( sizeof ( struct grade);fread(p2, sizeof ( struct grade),1,gfhead);p2-next = hp2;hp2 = p2;j -; while ( j 0 );if ( !feof(gfhead) & p1 != NULL)p1 - head = hp2;p1 = p1 - next;fclose(afhead);fclose(gfhead);void printm ( struct address *head)int i=0 , j;float iscore;struct gr

9、ade *ghd=NULL;struct address *hd=NULL;hd = head;system( cls );if (hd=NULL)printf(tt= No sourse in the file! =);return ;while (hd != NULL)gotoxy(1,i+1);printf( =n );for (j=0;jstu_num); Name-spelling: %s, hd-ename );Sex:%s , hd-hname );Department: %s , hd-depart);Address: %s , hd-paddress); Phone numm

10、ber: %sn , hd-phone);printf(n);printf( tHisHer score is : n);ghd=hd-head;printf( name 地理 生物 物理 英语 数学 语文 n );printf( %s ,hd-ename);while ( ghd != NULL )printf( %dt, ghd-score);iscore += ghd - score;ghd = ghd-next;printf( n );hd = hd-next;i = i + 10;void delate ( struct address *head)char cinput20;str

11、uct address *PRE,*TARGE;TARGE = (*head);if (!TARGE)printf( = No any information! );return ;fflush(stdin);printf( Input the name or student nummber you want to delate:t);scanf( %s , cinput);while (stricmp(cinput, TARGE-stu_num)&stricmp(cinput ,TARGE-ename)& TARGE != NULL)PRE = TARGE;TARGE=TARGE-next;

12、if (TARGE = NULL)printf( = No this information! =n ); return ;if (TARGE = (*head) )(*head) = (*head) - next;return ;else PRE-next = TARGE-next;if (!TARGE) free(TARGE);/* 修改信息void revise ( struct address *head)int ch;char cinput20;char choice;struct address *TARGE = NULL;struct grade *move;do system(

13、 cls );printf( Input the name or student nummber you want to delate:t);fflush(stdin);scanf( %s , cinput);TARGE = head;while (stricmp( cinput, TARGE-stu_num) &stricmp(cinput ,TARGE-ename) & TARGE != NULL)TARGE = TARGE-next;if (TARGE = NULL) return ;printf(input the command:n1-revise the sex;tt);print

14、f( 2-revise the ename;n3-revise the studentnummber;ttprintf(printf(printf(printf(printf(fflush( stdin);do%d,&ch); while (ch12|chrevise the depart;n5-revise the address;tt 6-revise the phonen7-revise the geography;tt 8- 、revise the biologyn9-revise the physics;tt 10-revise the english;n11-revise the

15、maths ;tt 12-to revise the chinese、 n );););););case 1 : printf( scanf(IIenter the your sex male or female :n %s , TARGE-hname););break ;case 2 :printf(scanf(IIenter the name in Spell:n %s , TARGE-ename););break ;case 3 :printf(scanf(IIenter the Student nummer:n %s , &TARGE-stu_num);II);break ;case

16、4 :printf(scanf(IIinput your Department:n %s , TARGE-depart););break ;case 5 :printf(scanf(IIinput your present Address:n %s , TARGE-paddress);II);break ;case 6 :printf(scanf(IIinput your mobie nummer:n %s , TARGE-phone););break ;case 7 :printf(scanf(IIinput your geography scoren %d , &(move-score);

17、);break ;case 8 : moveg (8, &move); printf(input your biology scorenscanf( %d , &(move-score););break ;case 9 : moveg (9, &move); printf(input your physics score:n);scanf( %d , &(move-score);break ;case 10: moveg (10, &move); printf(input your english score:n);scanf( %d , &(move-score);break ;case 1

18、1: moveg (11, &move); printf(input your maths score:n);scanf( %d , &(move-score);break ;case 12: moveg (12, &move); printf(input your chinese score:n);scanf( %d , &(move-score); move=move-next;break ; default : ; fflush(stdin);printf( if you want to revise other detail formation input yn ); scanf( %

19、c , &choice); while (choice = y | choice = Y );void moveg ( int i, struct grade *move)for (i = i - 7; i 0; i-)( *move ) = ( *move ) - next; /* 删除原来的记录并保存现在的 ok! void saveda ( struct address *tou)FILE *afhead , *gfhead; struct grade *gcu; struct address *tail = tou;if (afhead = fopen( d:information 、

20、dat , wb ) = NULL)printf( !n );return ;if (gfhead = fopen( d:grade、dat , wb ) = NULL)printf( !n );return ;/* 打开保存数据的文件 */while (tail != NULL)fwrite(tail , sizeof ( struct address) , 1 , afhead); gcu = tail - head;while (gcu != NULL)fwrite(gcu , sizeof ( struct grade) , 1 , gfhead); gcu = gcu - next;

21、tail = tail - next;fclose(afhead);fclose(gfhead);void addnew ( struct address *head )struct address *phead = NULL , *pTempNode = NULL; struct grade *gh = NULL;pTempNode=( struct address *)malloc( sizeof ( struct address);printf(input num (stu_num);printf(input your sex male or female: );scanf(%s , p

22、TempNode-hname);printf(input name in spelling: );scanf(%s , pTempNode-ename);printf(input your department: );scanf(%s , pTempNode-depart);printf(input your address: );scanf(%s , pTempNode-paddress);printf(input your phone nummber: );scanf(%s , pTempNode-phone);pTempNode - next = NULL;pTempNode - hea

23、d = NULL;fflush(stdin);printf(input chinese: );pTempNode-head = ( struct grade *)malloc( sizeof ( struct grade);scanf( %d , &pTempNode-head-score);gh = pTempNode-head; printf( input maths score: );gh - next = (struct grade *)malloc(gh = gh - next;scanf( %d , &gh - score);printf(input English score: );gh-next = (struct grade *

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论