学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx

上传人:wj 文档编号:1504800 上传时间:2023-04-30 格式:DOCX 页数:15 大小:14.81KB
下载 相关 举报
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第1页
第1页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第2页
第2页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第3页
第3页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第4页
第4页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第5页
第5页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第6页
第6页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第7页
第7页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第8页
第8页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第9页
第9页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第10页
第10页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第11页
第11页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第12页
第12页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第13页
第13页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第14页
第14页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx

《学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx(15页珍藏版)》请在冰点文库上搜索。

学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴文档格式.docx

);

scanf("

%d"

&

p->

cla);

printf("

请输入学号:

%ld"

num);

printf("

请输入姓名:

%s"

p->

name);

请输入性别:

sex);

请输入语文成绩:

%f"

chinese);

请输入数学成绩:

math);

请输入英语成绩:

english);

p->

sum=p->

chinese+p->

math+p->

english;

ave=p->

sum/3;

head=p;

if(n==1){

p->

next=NULL;

}}

else{

s=(Lstu*)malloc(sizeof(Lstu));

s->

s->

s->

sum=s->

chinese+s->

math+s->

ave=s->

next=s;

p=s;

}

}

voidList(){//输出链表内容

Lstu*p;

inti=0;

p=head;

if(p==NULL){

printf("

Sorry,It'

saEmptyList\n"

else{

printf("

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

\t%-5s%-5s%-10s%-8s%-7s%-10s%-10s%-10s\n"

"

序号"

班级"

学号"

姓名"

性别"

语文成绩"

数学成绩"

英语成绩"

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

while(p){i++;

ID=i;

printf("

\t%-4d%-5d%-7d%-8s%-7s%-10.2f%-10.2f%-10.2f\n"

ID,p->

cla,p->

num,p->

name,p->

sex,p->

chinese,p->

math,p->

p=p->

next;

}

}

voidlist(){//输出链表所有内容

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

%-5s%-5s%-7s%-8s%-7s%-10s%-10s%-10s%-8s%-8s\n"

"

总分"

平均分"

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

%-4d%-6d%-12d%-8s%-7s%-10.2f%-10.2f%-10.2f%-8.2f%-8.2f\n"

sex,

p->

english,p->

sum,p->

ave);

voidsave(){//文件保存

FILE*fp;

Lstu*p;

p=head;

if((fp=fopen("

初始值二进制.txt"

wb"

))==NULL)

{

printf("

Cannotopenthefile"

exit(0);

}

while(p){

fwrite(p,sizeof(Lstu),1,fp);

p=p->

fclose(fp);

voidsave1(){//文件保存

初始值二进制备用.txt"

voidread(){//文件读取

Lstu*p,*p1;

rb"

Cannotopenthefile\n"

}head=(Lstu*)malloc(sizeof(Lstu));

p1=head;

while(!

feof(fp)){

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

if(fread(p,sizeof(Lstu),1,fp)==1)

{

p1->

next=p;

p1=p1->

}

}head=head->

fclose(fp);

voidread1(){//文件读取

voidSAVE(){//保存到可浏览文件

inti=0;

初始值可浏览文件.txt"

w+"

fprintf(fp,"

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

i++;

fprintf(fp,"

name,

voidSAVE1(){//保存到可浏览文件

charfilename[20];

printf("

请输入保存到可浏览文件的文件名:

scanf("

filename);

if((fp=fopen(filename,"

%-4d%-5d%-7d%-8s%-7s%-10.2f%-10.2f%-10.2f%-8.2f%-8.2f\n"

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

voidsort_data_copy(Lstu*p,Lstu*s){//交换排序时的值

intcla1;

cla1=p->

cla;

cla=s->

cla=cla1;

longnum1;

num1=p->

num;

num=s->

num=num1;

charname1[20];

strcpy(name1,p->

strcpy(p->

name,s->

strcpy(s->

name,name1);

charsex1[20];

strcpy(sex1,p->

sex,s->

sex,sex1);

floatchinese1;

chinese1=p->

chinese;

chinese=s->

chinese=chinese1;

floatmath1;

math1=p->

math;

math=s->

math=math1;

floatenglish1;

english1=p->

english=s->

english=english1;

floatsum1;

sum1=p->

sum;

sum=sum1;

floatave1;

ave1=p->

ave;

ave=ave1;

voidsort(){//对初始成绩进行排序

intn;

chara;

read();

p=head;

\n按Enter键继续\n"

a=getch();

else{while

(1){system("

cls"

printf("

\n排序前结果为:

\n"

read();

list();

printf("

\t*=*=*=*=*=*=*=*=*=*=*=按学号排序

(1)\n"

\t*=*=*=*=*=*=*=*=*=*=*=按语文成绩排序

(2)\n"

\t*=*=*=*=*=*=*=*=*=*=*=按数学成绩排序(3)\n"

\t*=*=*=*=*=*=*=*=*=*=*=按英语成绩排序(4)\n"

\t*=*=*=*=*=*=*=*=*=*=*=按平均分排序(5)\n"

\t*=*=*=*=*=*=*=*=*=*=*=回主菜单(0)\n\n"

\t请输入选择:

scanf("

n);

for(p=head;

next!

=NULL;

p=p->

next)

for(s=p->

s!

s=s->

switch(n){

case1:

if(p->

num>

num){sort_data_copy(p,s);

}break;

case2:

chinese<

chinese){sort_data_copy(p,s);

case3:

math<

math){sort_data_copy(p,s);

case4:

english<

english){sort_data_copy(p,s);

case5:

ave>

ave){sort_data_copy(p,s);

case0:

break;

default:

chooeerror!

"

break;

if(n==0){printf("

\n按Enter键回主菜单\n"

else{printf("

排序后结果为:

list();

SAVE1();

}}}

voidsort1(){//对所有数据进行排序

read1();

read1();

voidsearch_print(Lstu*p){//输出查找信息

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

\t%-5s%-7s%-8s%-7s%-10s%-10s%-10s\n"

\t%-5d%-7d%-8s%-7s%-10.2f%-10.2f%-10.2f\n"

voidsearch_choose(){//选择按分数段查找方式

intn,i=1,flag=0;

floata,b;

p=head;

\t*=*=*=*=*=*=*=*=*=*=*=按语文分数段查找

(1)\n"

\t*=*=*=*=*=*=*=*=*=*=*=按数学分数段查找

(2)\n"

\t*=*=*=*=*=*=*=*=*=*=*=按英语分数段查找(3)\n\n"

scanf("

请输入分数下限(包括输入的分数):

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

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2