c语言学生档案管理系统Word下载.docx
《c语言学生档案管理系统Word下载.docx》由会员分享,可在线阅读,更多相关《c语言学生档案管理系统Word下载.docx(25页珍藏版)》请在冰点文库上搜索。
![c语言学生档案管理系统Word下载.docx](https://file1.bingdoc.com/fileroot1/2023-5/4/3158060b-6864-4fb9-a2c3-85860fdfbcba/3158060b-6864-4fb9-a2c3-85860fdfbcba1.gif)
p1=p2=(structcourse*)malloc(sizeof(structcourse));
strcpy(p2->
student_ID,student_ID);
course_ID,course_ID);
p2->
score=score;
next=NULL;
p1=head_c;
if(head_c==0)head_c=p2,p2->
else
{
while((strcmp(p2->
student_ID,p1->
student_ID)>
0)&
&
(p1->
next!
=NULL))
{
p=p1;
p1=p1->
next;
}
if(strcmp(p2->
student_ID,p1->
student_ID)<
0)
if(head_c==p1)head_c=p2;
elsep->
next=p2;
p2->
next=p1;
}
else
p1->
p2->
}
ccount++;
是否退出?
(Y\N)\n"
getchar();
%c"
&
cho);
}
while(cho!
='
n'
cho!
N'
return(head_c);
}
structstudent*add_info()
structstudent*p1,*p2,*p;
student_ID,name,telephone\n"
%s%s%s"
student_ID,name,telephone);
p1=p2=(structstudent*)malloc(sizeof(structstudent));
name,name);
telephone,telephone);
p1=head_s;
if(head_s==0)head_s=p2,p2->
{
if(head_s==p1)head_s=p2;
scount++;
(Y/N)\n"
return(head_s);
voidadd()
intcho;
do
-------增加学生档案信息--------\n"
1.增加学生基本信息\n2.增加学生成绩\n0.退出\n"
\n请选择:
"
%d"
switch(cho)
case1:
head_s=add_info();
break;
case2:
head_c=add_score();
case0:
;
=0);
voidprint_c()
structcourse*p;
printf("
\nNow,These%drecordsare:
\n"
ccount);
p=head_c;
if(head_c!
=NULL)
do
printf("
%s%s%d\n"
p->
student_ID,p->
course_ID,p->
p=p->
while(p!
=NULL);
voidprint_s()
structstudent*p;
scount);
p=head_s;
if(head_s!
%s%s%s\n"
name,p->
telephone);
voidprint()
-------打印学生档案信息--------\n"
1.打印学生基本信息\n2.打印学生成绩\n0.退出\n"
print_s();
print_c();
voidinit()
FILE*fp1,*fp2;
structstudent*p1,*p2;
structcourse*p3,*p4;
structstud
charstudent_ID[10];
charname[10];
chartelephone[12];
}stu;
structcour
charcourse_ID[10];
intscore;
}cou;
if((fp1=fopen("
E:
\\jiguiyang\\basic_info.dat"
"
rb"
))==NULL)
没有学生信息数据,请添加学生信息!
else
fread(&
stu,sizeof(structstud),1,fp1);
while(!
feof(fp1))
{
p2=(structstudent*)malloc(sizeof(structstudent));
strcpy(p2->
student_ID,stu.student_ID);
name,stu.name);
telephone,stu.telephone);
p2->
if(head_s==0)
head_s=p2,p1=head_s;
next=p2,p1=p1->
scount++;
fread(&
fclose(fp1);
}
if((fp2=fopen("
\\jiguiyang\\score.dat"
没有学生成绩,请添加学生成绩!
cou,sizeof(structcour),1,fp2);
feof(fp2))
p4=(structcourse*)malloc(sizeof(structcourse));
strcpy(p4->
student_ID,cou.student_ID);
course_ID,cou.course_ID);
p4->
score=cou.score;
if(head_c==0)
head_c=p4,p3=head_c;
p3->
next=p4,p3=p3->
ccount++;
fclose(fp2);
voidsave()
structstudent*p1;
structcourse*p2;
wb"
if(head_s!
do
strcpy(stu.student_ID,p1->
student_ID);
strcpy(stu.name,p1->
name);
strcpy(stu.telephone,p1->
fwrite(&
while(p1!
fclose(fp1);
p2=head_c;
if(head_c!
strcpy(cou.student_ID,p2->
strcpy(cou.course_ID,p2->
course_ID);
cou.score=p2->
score;
p2=p2->
while(p2!
fclose(fp2);
structstudent*alter_info()
{
voidsave();
if(head_s==NULL)
没有%s号学生基本信息!
student_ID);
returnhead_s;
{
请输入要修改学生的学号:
%s"
getchar();
p1=head_s;
while(strcmp(student_ID,p1->
student_ID)!
=0&
next)!
p1=p1->
}
if(strcmp(student_ID,p1->
student_ID)==0)
%s号学生的基本信息为:
%s%s%s"
p1->
name,p1->
getchar();
是否修改姓名?
cho=getchar();
if(cho=='
Y'
||cho=='
y'
)
printf("
请输入修改后的姓名:
scanf("
name);
strcpy(p1->
是否修改电话号码?
)
请输入修改后的电话号码:
telephone);
信息已修改,修改后%s号学生的基本信息为:
没有%s号学生信息\n"
是否继续?
cho=getchar();
}while(cho=='
||cho=='
save();
returnhead_s;
structcourse*alter_score()
structcourse*p1;
charcourse[10];
intscore;
charcho;
if(head_c==NULL)
{
}
%s%s%d"
student_ID,course,score);
是否修改课程?
请输入修改后的课程:
course);
strcpy(course,course);
是否修改成绩?
请输入修改后的成绩:
while(cho=='
save();
returnhead_c;
voidquery_s()
charn;
structstudent*p1;
student_ID\n"
while((strcmp(p1->
student_ID,student_ID)!
=0)&
if(strcmp(p1->
student_ID,student_ID)==0)
{
%s号学生的基本信息:
%s,%s,%s\n"
student_ID,p1->
if(strcmp(p1->
student_ID,student_ID)!
=0)
没有%s号学生的基本信息!
是否继续?
输y继续"
n=getchar();
while(n=='
||n=='
voidquery_c()
structcourse*p1;
%s号学生的成绩:
%s,%s,%d\n"
course_ID,p1->
没有%s号学生的成绩!
||'
voidalter()
-------修改学生档案信息--------\n"
1.修改学生基本信息\n2.修改学生成绩信息\n0.退出\n"
alter_info();
alter_score();
}while(cho!
voiddelet_info()
structstudent*p,*p1;
do
请输入要删除的学生学号:
p1=p=head_s;
while(strcmp(student_ID,p->
p->
p1=p;
if(strcmp(student_ID,p->