学生信息管理系统C语言实现Word格式文档下载.docx

上传人:b****5 文档编号:21378502 上传时间:2023-01-30 格式:DOCX 页数:16 大小:17.74KB
下载 相关 举报
学生信息管理系统C语言实现Word格式文档下载.docx_第1页
第1页 / 共16页
学生信息管理系统C语言实现Word格式文档下载.docx_第2页
第2页 / 共16页
学生信息管理系统C语言实现Word格式文档下载.docx_第3页
第3页 / 共16页
学生信息管理系统C语言实现Word格式文档下载.docx_第4页
第4页 / 共16页
学生信息管理系统C语言实现Word格式文档下载.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

学生信息管理系统C语言实现Word格式文档下载.docx

《学生信息管理系统C语言实现Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《学生信息管理系统C语言实现Word格式文档下载.docx(16页珍藏版)》请在冰豆网上搜索。

学生信息管理系统C语言实现Word格式文档下载.docx

structanalysis*next;

};

structstudent

charname_tea[20];

//教师名字

charname_stu[20];

//学生名字

charclas[20];

//班级

floatmatch;

//分数

structstudcode

structstudentdate;

structstudcode*next;

//建立链表的指针

intmain()

charchoose;

structstudcode*head=NULL;

structanalysis*head1=NULL;

//date_load(&

head);

instruct();

printf("

\n请选择功能:

"

);

choose=getchar();

while(choose!

='

0'

)//输入0结束程序

{

switch(choose)

{

case'

1'

:

input(&

//建立链表

getchar();

break;

2'

search(head);

//查找信息

case'

3'

dele(&

//删除信息

4'

increase(head);

//增加信息

5'

printall(head);

//输出全部信息

6'

average(head,&

head1);

//统计各科平均分并升序输出

default:

\n选择错误,重选\n"

}

instruct();

printf("

choose=getchar();

}

system("

cls"

date_save(head);

谢谢使用本系统\n"

return0;

}

voidinstruct(void)

system("

\n\t\t\t试验管理系统\t\t\t\t"

\n\t\t\t1建立学生信息链表\t\t\t\t"

\n\t\t\t2搜索学生相关信息\t\t\t\t"

\n\t\t\t3删除某个学生信息\t\t\t\t"

\n\t\t\t4增加某个学生信息\t\t\t\t"

\n\t\t\t5输出链表全部信息\t\t\t\t"

\n\t\t\t6统计各科目平均分\t\t\t\t"

\n\t\t\t0退出程序\t\t\t\t"

intinput(structstudcode**headp)

structstudcode*p,*tail;

chara[4];

date_load(headp);

if(*headp!

=NULL)

链表信息载入成功"

return1;

else

目前没有数据保存请从终端输入数据"

\n\t\t\t成绩输入功能\t\t\t\t"

p=(structstudcode*)malloc(sizeof(structstudcode));

if(p==NULL)

error"

exit(-1);

\n请按提示输入相关信息"

\n教师姓名:

scanf("

%s"

p->

date.name_tea);

学生姓名:

date.name_stu);

学生班级:

date.clas);

实验名称:

date.name_ex);

评分:

%f"

&

p->

date.match);

p->

next=*headp;

*headp=p;

tail=p;

是否继续输入输入NO退回主菜单其他任意字符继续当前操作\\\\"

a);

while(strcmp(a,"

NO"

)!

=0)

p=(structstudcode*)malloc(sizeof(structstudcode));

if(p==NULL)

printf("

exit(-1);

scanf("

p->

next=NULL;

tail->

next=p;

tail=p;

return1;

voidsearch(structstudcode*headp)

intflag=1;

chara[2][20],b[4]="

YES"

;

structstudcode*p;

\n┃\t\t\t成绩查询功能\t\t\t\t"

while(!

strcmp(b,"

))

p=headp;

\n学生姓名:

a[0]);

a[1]);

for(;

p!

=NULL;

p=p->

next)

flag=1;

if(strcmp(a[0],p->

date.name_stu)==0&

&

strcmp(a[1],p->

date.name_ex)==0)

{

flag=0;

picture();

output(p);

break;

}

if(flag==1)

\n请确认您输入的姓名或者实验名称是否正确"

\n是否要继续使用该功能YES/NO\\\\"

b);

\n\t\t\t成绩查询功能\t\t\t\t"

voidpicture()

\t\t\t实验成绩表"

\n教师姓名学生姓名学生班级实验名称实验成绩"

voidoutput(structstudcode*p)

\n%14s%13s%8s%19s%8.2f"

date.name_tea,p->

date.name_stu,p->

date.clas,p->

date.name_ex,p->

voiddele(structstudcode**headp)

structstudcode*p,*last;

chara[20],b[20],c[5]="

while(strcmp(c,"

)==0)

学生姓名"

实验名称"

p=*headp;

while(strcmp(a,p->

date.name_stu)!

=0&

strcmp(b,p->

date.name_ex)!

next!

last=p;

p=p->

next;

if(strcmp(a,p->

date.name_stu)==0&

if(p==*headp)

*headp=p->

else

last->

next=p->

free(p);

else

请确认您输入的姓名或者实验名称是否正确"

输入YES继续使用该功能,输入其他任意字符退回主菜单\\\\"

c);

voidprintall(structstudcode*headp)

chara[5];

picture();

if(headp!

output(headp);

headp=headp->

while(headp!

\n输入back返回主菜单"

back"

voidaverage(structstudcode*headp,structanalysis**head)

structanalysis*p=*head;

if(headp==NULL)

请先建立链表"

p=*head;

while(p!

aver=0;

p=p->

while(strcmp(headp->

name_ex)!

aver+=headp->

date.match;

p=*head;

aver/=p->

number;

sort(head);

//求出平均值后排序

%s平均分为%f\n"

name_ex,p->

aver);

输入back退回主菜单"

intsort(structanalysis**head)

intn=0,i,m,temp1;

floattemp2;

structanalysis*p,*j;

chartemp3[20];

j=p->

if(j==NULL)

//如果只有一个科目的数据则不排序

=NULL)//统计有几个科目,作为下面冒泡排序控制条件的依据

n+=1;

for(i=0;

i<

n-1;

i++,p=*head)

for(m=0,j=p->

m<

n-1-i;

m++)

if(p->

aver>

j->

aver)//排序时直接交换各节点数据

{

strcpy(temp3,p->

name_ex);

//交换实验名称

strcpy(p->

name_ex,j->

strcpy(j->

name_ex,temp3);

temp1=p->

//交换到课人数

p->

number=j->

j->

number=temp1;

temp2=p->

aver;

aver=j->

aver=temp2;

p=j;

j=j->

voiddate_load(structstudcode**headp)

charch;

FILE*f;

structstudcode*p,*tail;

if((f=fopen("

e:

\\input.txt"

"

a+"

))==NULL)

exit(0);

ch=fgetc(f);

//读取第一个空格,控制格式

if(ch!

=EOF)//如果文件中有保存的信息则读取

if((p=(structstudcode*)malloc(sizeof(structstudcode)))==NULL)

exit(0);

fscanf(f,"

%s%s%s%s%f\n"

date.name_ex,&

*headp=p;

while(!

feof(f))

if((p=(structstudcode*)malloc(sizeof(structstudcode)))==NULL)

printf("

exit(0);

fscanf(f,"

%s%s%s%s%f\n"

p->

tail->

tail=p;

fclose(f);

voiddate_save(structstudcode*headp)

inti;

是否要更新原有数据。

输入1进行更新,其他数字跳过更新步骤:

%d"

i);

if(i==1)//跟新数据的模块

if((f=fopen("

w"

}

while(p!

fprintf(f,"

fclose(f);

intincrease(structstudcode*headp)

chara[4]="

请先创建链表"

while(headp->

exit

(1);

教师姓名:

headp->

headp=p;

是否继续增加记录输入YES继续增加,输入其他任意字符退回主菜单"

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1