嵌入式培训班级成绩管理系统Word文档格式.docx

上传人:b****6 文档编号:17222207 上传时间:2022-11-29 格式:DOCX 页数:15 大小:17.58KB
下载 相关 举报
嵌入式培训班级成绩管理系统Word文档格式.docx_第1页
第1页 / 共15页
嵌入式培训班级成绩管理系统Word文档格式.docx_第2页
第2页 / 共15页
嵌入式培训班级成绩管理系统Word文档格式.docx_第3页
第3页 / 共15页
嵌入式培训班级成绩管理系统Word文档格式.docx_第4页
第4页 / 共15页
嵌入式培训班级成绩管理系统Word文档格式.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

嵌入式培训班级成绩管理系统Word文档格式.docx

《嵌入式培训班级成绩管理系统Word文档格式.docx》由会员分享,可在线阅读,更多相关《嵌入式培训班级成绩管理系统Word文档格式.docx(15页珍藏版)》请在冰豆网上搜索。

嵌入式培训班级成绩管理系统Word文档格式.docx

structseqlist*seqlist_init(void)

{

structseqlist*p;

//用malloc在堆中申请一块顺序表的空间

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

if(p==NULL){//malloc申请空间失败

printf("

mallocfailed!

\n"

);

exit(-1);

//结束程序,在程序的任何位置都可以调用该函数结束程序

}

p->

last=-1;

returnp;

}

//2、顺序表的插入seqlist_insert

//#include"

boolseqlist_insert(datatypetmp,structseqlist*l)

if(l->

last==SIZE-1){//顺序表满了

seqlistisfull!

returnfalse;

}else{

//l->

last=l->

last+1;

l->

last++;

data[l->

last]=tmp;

returntrue;

//3、顺序表的删除seqlist_del

boolseqlist_del(datatypetmp,structseqlist*l)

inti,j;

if(seqlist_isempty(l))

i=seqlist_search(tmp.sno,l);

if(i==-1){

您要删除的数据不存在!

}else{//删除第i个位置的数据

for(j=i;

j<

last;

j++)

data[j]=l->

data[j+1];

last--;

//4、判断顺序表是否为空seqlist_isempty

boolseqlist_isempty(structseqlist*l)

if(-1==l->

last)

else

//5、预览顺序表中的每一条数据seqlist_show

voidseqlist_show(structseqlist*l)

inti;

for(i=0;

i<

=l->

i++)

%d%s%f\n"

l->

data[i].sno,l->

data[i].name,l->

data[i].score);

//在顺序表中查找一条记录,如果存在则返回下标,如果不存在,则返回-1seqlist_search

intseqlist_search(intkey,structseqlist*l)

return-1;

else{

i++){//寻找要删除的数据

if(key==l->

data[i].sno)

returni;

continue;

//按照学号排序seqlist_sort

voidseqlist_sort(structseqlist*l)

structstudenttmp;

for(j=0;

last-i;

data[j].score<

data[j+1].score){//根据分数排序

//if(l->

data[j].sno>

data[j+1].sno){//根据学号排序

tmp=l->

data[j];

l->

data[j+1]=tmp;

//menu1

voidmenu1(void)

**********************\n"

**班级成绩管理系统**\n"

**a、成绩录入**\n"

**b、成绩显示**\n"

**c、成绩保存**\n"

**d、成绩排序**\n"

**e、成绩修改**\n"

**f、成绩统计**\n"

**g、退出系统**\n"

//menu2

voidmenu2(void)

*************************\n"

**1.每门课程成绩最高的学生的基本信息**\n"

**2.每门课程的平均成绩**\n"

**3.超过某门课程平均成绩的学生人数**\n"

voidSave(structseqlist*l,intn)//学生基本信息保存

FILE*fp;

fp=fopen("

~/五邑/student.txt"

"

w+"

if(fp==NULL)

{

文件不存在!

exit(0);

intmain(void)

structseqlist*l;

datatypedata;

charch;

l=seqlist_init();

while

(1)

ccc:

menu1();

请输入你的选择:

scanf("

%c"

&

bb);

cho=bb;

if((cho=='

a'

)||(cho=='

A'

))

成绩录入:

"

请输入学号姓名数学语文英语政治\n"

%d%s%f%f%f%f"

data.sno,&

data.name,&

data.score[0],&

data.score[1],&

data.score[2],&

data.score[3])

seqlist_insert(data,l);

//将数据存储在顺序表中

是否继续(Y/N)?

while(getchar()!

='

\n'

ch);

if((ch=='

N'

)||(ch=='

n'

break;

elseif((ch=='

Y'

y'

continue;

选择错误!

elseif((cho=='

b'

B'

{

成绩显示:

seqlist_show(l);

='

gotoccc;

elseif((cho=='

c'

C'

{

printf("

成绩保存:

Save(l,SIZE);

成绩已保存\n"

}

d'

D'

{

成绩排序:

seqlist_sort(l);

e'

E'

成绩修改:

data.score[3]);

intseqlist_search(data,l);

boolseqlist_insert(data,l);

while(getchar()!

f'

F'

intcv;

成绩统计:

menu2();

printf("

%d"

cv);

switch(cv)

case1:

显示每门课程成绩最高的学生的基本信息:

seqlist_show(l);

break;

case2:

显示每门课程的平均成绩:

case3:

显示超过某门课程平均成绩的学生人数\n"

default:

请重新选择!

gotoccc;

}

while(getchar()!

g'

G'

欢迎使用班级成绩管理系统,Bye-bye!

!

return0;

else{printf("

}

return0;

单向链表程序:

structnode{

structnode*next;

structnode*linklist_init(void);

boollinklist_insert(datatypedata,structnode*h);

boollinklist_del(datatypedata,structnode*h);

boollinklist_isempty(structnode*h);

voidlinklist_show(structnode*h);

structnode*linklist_init(void)

structnode*p;

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

if(p==NULL){

next=NULL;

boollinklist_insert(datatypedata,structnode*h)

structnode*new;

new=(structnode*)malloc(sizeof(structnode));

if(new==NULL){

new->

data=data;

next=h->

next;

h->

next=new;

boollinklist_del(datatypedata,structnode*h)

structnode*p,*tmp;

if(linklist_isempty(h))

//链表为空,返回假

for(p=h;

next!

=NULL;

p=p->

next){

if(p->

next->

data.num==data.num){

tmp=p->

next=tmp->

free(tmp);

//数据存在,成功删除,返回真

}}

//要删除的数据不存在,则返回假

boollinklist_isempty(structnode*h)

if(h->

next==NULL)

voidlinklist_show(structnode*h)

structnode*p=h->

while(p!

=NULL){

printf(“%d%s%f%f%f%f"

p->

data.sno,p->

data.name,p->

data.score[0],p->

data.score[1],p->

data.score[2],p->

data.score[3]"

p=p->

linklist.h"

structnode*h;

h=linklist_init();

while

(1)

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

当前位置:首页 > 解决方案 > 解决方案

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

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