学生成绩管理系统+++数据结构课程设计Word文档格式.docx

上传人:b****6 文档编号:17208034 上传时间:2022-11-28 格式:DOCX 页数:46 大小:116.04KB
下载 相关 举报
学生成绩管理系统+++数据结构课程设计Word文档格式.docx_第1页
第1页 / 共46页
学生成绩管理系统+++数据结构课程设计Word文档格式.docx_第2页
第2页 / 共46页
学生成绩管理系统+++数据结构课程设计Word文档格式.docx_第3页
第3页 / 共46页
学生成绩管理系统+++数据结构课程设计Word文档格式.docx_第4页
第4页 / 共46页
学生成绩管理系统+++数据结构课程设计Word文档格式.docx_第5页
第5页 / 共46页
点击查看更多>>
下载资源
资源描述

学生成绩管理系统+++数据结构课程设计Word文档格式.docx

《学生成绩管理系统+++数据结构课程设计Word文档格式.docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统+++数据结构课程设计Word文档格式.docx(46页珍藏版)》请在冰豆网上搜索。

学生成绩管理系统+++数据结构课程设计Word文档格式.docx

二、数据结构的设计

structperson

{

charname[20];

longnum;

floatmath;

floatEnglish;

floatchinese;

floataverage;

floatsum;

}student;

三、模块:

学生成绩管理系统模块

四、算法的设计

1.在此成绩管理系统中,要求用户输入的只是有字符型和数值型数据,所以我设计了下面函数来处理并对输出的数据进行检验。

intN=0;

Enter()

{

FILE*fp;

charch;

charch2;

charnumstr[20];

structpersonstudent2;

clrscr();

fp=fopen("

jie.txt"

"

ab"

);

if(fp==NULL)

printf("

can'

topenthisfile.\n"

waitforasecondwithpatience.\nthesystemisexiting.\n"

getch();

exit(0);

}

else

do{

yourname:

"

gets(student.name);

\nyournum:

gets(numstr);

student.num=atol(numstr);

\nyourmath:

student.math=atof(numstr);

\nyourEnglish:

student.English=atof(numstr);

\nyourchinese:

student.chinese=atof(numstr);

student.sum=student.chinese+student.math+student.English;

student.average=student.sum/3;

fwrite(&

student,sizeof(structperson),1,fp);

N++;

Doyoucontinueaddingotherstudents(Y/N)?

\n"

ch=getchar();

getchar();

}while(ch=='

y'

||ch=='

Y'

Showall(Y/N)?

ch2=getchar();

if(ch2=='

||ch2=='

Listall();

fclose(fp);

return_confirm();

2.查询学生记录

当用户执行此查询任务时,系统会提示用户进行查询字段的选择,即按学号或按姓名进行查询。

若此学生记录存在,则会打印输出此学生记录的信息。

Search()

{

charchoice;

charch1;

charch3;

charch4;

***WAYSOFSEARCHING***\n"

---------------------------\n"

**1.name**\n"

**2.num**\n"

----------------------------\n"

giveyourchoice:

choice=getchar();

while(choice>

'

2'

||choice<

1'

Sorry.yourchoiceiswrong.\npleasegiveacorrectone:

3.根据姓名或学号进行查找

switch(choice)

case'

:

do{

Loop1:

inputthenameofstudentsyouwanttosearch:

gets(name);

Search1(name);

GOONSEARCHINGBYNAEM(Y/N)?

}while(ch2=='

Searchbyotherways(Y/N)?

ch3=getchar();

if(ch3=='

||ch3=='

gotoLoop2;

break;

Loop2:

inputthenumofstudentsyouwanttosearch:

num=atol(numstr);

Search2(num);

GOONSEARCHINGBYNUM(Y/N)?

ch1=getchar();

}while(ch1=='

||ch1=='

}

Search2(longnum)

intflag=0;

intt;

rb"

flag=0;

t=0;

while(fread(&

student,sizeof(structperson),1,fp))

if(num==student.num)

name\t\tnum\tchinese\tEnglish\tmath\sum\taverage\n"

%-10s%-6ld%-8.2f%-8.2f%-8.2f%-8.2f%-8.2f\n"

student.name,student.num,student.chinese,student.English,student.math,student.sum,student.average);

t=1;

if(t==0)

Sorry.thestudentyouaresearchingnotexisted.\n"

rewind(fp);

Search1(char*name)

if((strcmp(name,student.name))==0)

Delete()

structpersonstudent1[30],student2[30];

inti;

intk;

intj;

intflag;

rb+"

i=0;

j=0;

inputthenameofstudentsyouaregoingtodelete.\n"

scanf("

%s"

name);

student,sizeof(structperson),1,fp)==1)

if((strcmp(name,student.name))!

=0)

student2[j]=student;

j++;

flag=1;

name\t\t\tnum\tchinese\t\tEnglish\t\tmath\tsum\taverage\n"

%-10s%-6ld%8.2f%8.2f%8.2f%8.2f%8.2f\n"

Delete(Y/N)?

toupper(ch);

if(ch=='

N'

gotoLoop;

}

j=%d\n"

j);

k=j;

if(flag==0)

if(flag==1)

Congratulation!

yousucceed\n"

wb+"

student2[i],sizeof(structperson),1,fp);

i++;

}while(i<

k);

Loop:

Goon(Y/N)?

{

4.修改学生记录

在修改学生记录操作中,系统会先按输入的学号或姓名查找该记录,然后提示用户修改学号或姓名之外的值,但学号或姓名不能修改。

Revise()

longoffset=sizeof(structperson);

again:

nameofrivesingstudent:

fread(&

thefollowingisinformationofstudentbeingdeleted:

name\t\tnum\tmath\tchinese\tEnglish\tsum\taverage\n"

***informationsforrevising***\n"

====================================\n"

#1.name2.num#\n"

#3.math4.English#\n"

#5.chinese6.total#\n"

giveachoice:

while(ch>

6'

||ch<

Sorry.youputiswrong.\npleaseinputanotherchoice:

switch(ch)

ass_revise("

name"

num"

3'

math"

4'

English"

5'

chinese"

total"

ass_revise("

Continuerevisingthesamestudent(Y/N)?

fseek(fp,-offset,1);

thefollowingisinformationofstudenthadbeenrevised:

}while(fread(&

student,sizeof(structperson),1,fp));

Sorry.thestudentofrevingnotexisted.\n"

GOONRevising(Y/N)?

if(ch1=='

gotoagain;

5.对学生记录进行排序

Order()

floata[30],b[30],c[30],d[30];

structpersonstudent1[30];

topent

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

当前位置:首页 > 初中教育 > 理化生

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

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