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

上传人:b****1 文档编号:13167081 上传时间:2022-10-07 格式:DOCX 页数:15 大小:14.81KB
下载 相关 举报
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴Word格式.docx_第1页
第1页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴Word格式.docx_第2页
第2页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴Word格式.docx_第3页
第3页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴Word格式.docx_第4页
第4页 / 共15页
学生成绩管理系统链表版C代码包含所有功能适合初学者借鉴Word格式.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

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

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

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

Lstu*p,*s;

inti;

for(i=0;

i<

n;

i++){

if(i==0){

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

printf("

请输入第%d个人的信息\n"

i+1);

请输入班级:

"

);

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,

\t---------------------------------

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

当前位置:首页 > 职业教育 > 职业技术培训

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

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