语言输入输出排序打印学生成绩单Word格式文档下载.docx

上传人:b****6 文档编号:20337266 上传时间:2023-01-22 格式:DOCX 页数:15 大小:16.96KB
下载 相关 举报
语言输入输出排序打印学生成绩单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

printf("

Inputstudentnumber(n<

30):

"

);

scanf("

%d"

&

n);

if(n>

N||n<

1)

return0;

else

//主程序

while(con!

=0)

{

//输出

printf("

\nManagementforStudents'

scores\n"

1.Appendrecord\n"

2.Calculatetotalandaveragescoreofeverycourse\n"

3.Calculatetotalandaveragescoreofeverystudent\n"

4.Sortindescendingorderbytotalscoreofeverystudent\n"

5.Sortinascendingorderbytotalscoreofeverystudent\n"

6.Sortinascendingorderbynumber\n"

7.Sortindictionaryorderbyname\n"

8.Searchbynumber\n"

9.Searchbyname\n"

10.Statisticanalysis\n"

11.Listrecord\n"

12.Writetoafile\n"

13.Readfromafile\n"

0.Exit\n"

//录入学生的人数:

PleaseInputyourchoice:

scanf("

con);

//录入每个学生的学号、姓名和各科成绩:

if(con==1)

{

printf("

Inputstudent'

sID,nameandscore:

\n"

for(i=0;

i<

n;

i++)

{

scanf("

%ld"

&

stu[i].id);

getchar();

fgets(stu[i].name,sizeof(stu[i].name),stdin);

///有问题!

%f%f%f"

stu[i].score[0],&

stu[i].score[1],&

stu[i].score[2]);

}

}

//计算每门课程的总分和平均分:

elseif(con==2)

addc(stu,n);

//计算每个学生各门课程的总分和平均分:

elseif(con==3)

adds(stu,n);

//按总成绩由高到低排出名次表:

elseif(con==4)

Sortindescendingorderbytotalscoreofeverystudent:

NO\tName\tMT\tEN\tPH\tSUM\tAVER\n"

pxs(stu,ds,n);

//按总成绩由低到高排出名次表:

elseif(con==5)

Sortinascendingorderbytotalscoreofeverystudent:

pxs(stu,as,n);

//按学号由小到大排出成绩表:

elseif(con==6)

Sortinascendingorderbynumber:

pxi(stu,n);

//按姓名的字典顺序排出成绩表:

elseif(con==7)

Sortindictionaryorderbyname:

pxn(stu,n);

//按学号查询学生排名、学号、姓名及其考试成绩:

elseif(con==8)

seai(stu,n);

//按姓名查询学生排名、学号、姓名及其考试成绩:

elseif(con==9)

sean(stu,n);

//按100,(90~100)(80~89)(70~79)(60~69)(0~59)统计各科每个类别的人数以及所占的百分比:

elseif(con==10)

ana(stu,n);

//输出信息

elseif(con==11)

for(i=0;

i<

n;

i++)

printf("

%ld\t"

stu[i].id);

for(j=0;

stu[i].name[j]!

='

\n'

;

j++)

{

putchar(stu[i].name[j]);

}

\t%.0f\t%.0f\t%.0f\t%.0f\t%.0f\n"

stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],(stu[i].score[3]/3));

//写入文件

elseif(con==12)

wri(stu,n);

//读取文件

elseif(con==13)

rea(stu,n);

elseif(con==0)

Endofprogram!

else

Inputerror!

}

}

return0;

}

voidaddc(structstudent*pt,intn)

inti,j;

floatsum;

for(j=0;

j<

3;

sum=0;

for(i=0;

sum+=stu[i].score[j];

printf("

course%d:

sum=%.0f,aver=%.0f\n"

(j+1),sum,(sum/n));

voidadds(structstudent*pt,intn)

inti;

for(i=0;

stu[i].score[3]=stu[i].score[0]+stu[i].score[1]+stu[i].score[2];

student%d:

(i+1),stu[i].score[3],(stu[i].score[3]/3));

voidpxs(structstudent*pt,int(*comp)(floata,floatb),intn)

structstudenttemp;

for(j=0;

(n-i-1);

if((*comp)(stu[j].score[3],stu[j+1].score[3]))

temp=stu[j];

stu[j]=stu[j+1];

stu[j+1]=temp;

putchar(stu[i].name[j]);

intds(floata,floatb)

returna<

b;

intas(floata,floatb)

returna>

voidpxi(structstudent*pt,intn)

if(stu[j].id>

stu[j+1].id)

voidpxn(structstudent*pt,intn)

if(strcmp(stu[j].name,stu[j+1].name)>

0)

voidseai(structstudent*pt,intn)

inti,j,con=0;

longid;

Inputthenumberyouwanttosearch:

id);

if(stu[j].score[3]<

stu[j+1].score[3])

if(stu[i].id==id)

%d\t%ld\t"

(i+1),stu[i].id);

for(j=0;

con=1;

break;

if(con==0)

Notfound!

voidsean(structstudent*pt,intn)

charname[10];

Inputthenameyouwanttosearch:

getchar();

fgets(name,sizeof(name),stdin);

if(strcmp(stu[i].name,name)==0)

voidana(structstudent*pt,intn)

inti,j,n1,n2,n3,n4,n5,n6;

n1=0;

n2=0;

n3=0;

n4=0;

n5=0;

n6=0;

if(stu[i].score[j]<

60)

n1+=1;

elseif(stu[i].score[j]<

70)

n2+=1;

80)

n3+=1;

90)

n4+=1;

=100)

n5+=1;

if(stu[i].score[j]==100)

n6+=1;

Forcourse%d:

(j+1));

<

60\t%d\t%.2f%%\n"

n1,100*(float)n1/n);

%d-%d\t%d\t%.2f%%\n"

60,69,n2,100*(float)n2/n);

70,79,n3,100*(float)n3/n);

80,89,n4,100*(float)n4/n);

90,100,n5,100*(float)n5/n);

%d\t%d\t%.2f%%\n"

100,n6,100*(float)n6/n);

voidwri(STUDENT*pt,intn)

FILE*fp;

if((fp=fopen("

student.txt"

"

w"

))==NULL)

exit(0);

//fprintf(fp,"

fprintf(fp,"

fprintf(fp,"

%c"

stu[i].name[j]);

fclose(fp);

savesuccessfully!

voidrea(STUDENT*pt,intn)

intm;

longa;

floatc,d,e,f,g;

charb[10];

//charhead[50];

r"

exit(0);

//fgets(head,50,fp);

//puts(head);

for(m=0;

m<

m++)

//printf("

scjdbfdsdj"

fscanf(fp,"

a);

a);

%10s"

b);

%s\t"

fscanf(fp,"

%f"

c);

%.0f\t"

c);

%f"

d);

d);

e);

e);

f);

f);

g);

%.0f\n"

g);

//printf("

jdhergjdkfnjherdgfdhb\n"

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

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

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

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