C语言学生管理系统综合实验报告Word文档格式.docx
《C语言学生管理系统综合实验报告Word文档格式.docx》由会员分享,可在线阅读,更多相关《C语言学生管理系统综合实验报告Word文档格式.docx(22页珍藏版)》请在冰豆网上搜索。
c)统计:
可以选择统计各学生的平均成绩或统计所有存在不及格科目的学生;
5.数据输出:
输出学生的相应结果信息;
6.退出:
退出整个学生信息管理系统。
7.输出结果截屏的第一条记录一定要反映出你自己的真实信息。
三、程序组织结构图、函数调用关系图
四、程序清单
#include<
stdio.h〉
#include<
iostream。
h〉
#include〈string。
h>
structstudent
{
charnum[10];
charname[10];
charsex[4];
charclas[20];
intyw,sx,yy;
floatave;
}stu[100];
inti,j;
voidInputData()
{
charx;
while
(1)
printf(”\t学号:
”);
scanf(”%s"
,stu[i]。
num);
printf(”\t姓名:
”);
scanf(”%s"
stu[i].name);
printf("
\t性别:
"
);
scanf("
%s”,stu[i]。
sex);
\t班级:
scanf(”%s"
stu[i].clas);
\t语文:
scanf(”%d"
,&stu[i]。
yw);
\t数学:
%d"
,&
stu[i]。
sx);
printf(”\t英语:
scanf(”%d”,&stu[i].yy);
stu[i]。
ave=float((stu[i].yw+stu[i]。
sx+stu[i].yy)/3。
0);
i++;
printf(”\t是否继续输入数据(Y。
N)"
cin>
〉x;
if(x==’n'
||x==’N’)break;
}
}
voidEditData()
intcount=0;
charstr[10];
printf(”\n请输入学生学号:
〉str;
while(count〈i)
if(strcmp(str,stu[count].num)==0)
printf("
学号姓名性别班级语文数学英语\n”);
-——--—----—---—-—————--—-———--——--———--———-------—-——-——-———--——\n"
%-11s"
stu[count]。
num);
printf(”%—13s”,stu[count]。
name);
printf(”%—8s"
,stu[count].sex);
printf(”%-16s"
,stu[count]。
clas);
%-6d"
,stu[count].yw);
printf(”%—6d”,stu[count]。
%—4d”,stu[count].yy);
printf(”\n”);
printf(”-—-——————-—--——-—-—--—----————--—---——-———---——----——————--—-———\n"
break;
count++;
if(count>
=i)
printf(”\n查无此人”);
else
\n\t修改数据:
\n”);
\t学号:
stu[i]。
\t姓名:
scanf(”%s”,stu[i]。
%s"
,stu[i].clas);
printf(”\t语文:
);
%d”,&stu[i].yw);
\t数学:
stu[i]。
sx);
%d”,&
stu[i]。
yy);
stu[count]。
ave=float((stu[count]。
yw+stu[count].sx+stu[count].yy)/3。
0);
}
voidsx()
structstudenttemp;
inta,b,c;
for(a=0;
a<
i—1;
a++)
c=a;
for(b=a+1;
b〈i;
b++)
if(stu[b]。
ave>
stu[c]。
ave)
c=b;
temp=stu[b];
stu[b]=stu[c];
stu[c]=temp;
排序后结果为:
printf(”学号姓名性别班级语文数学英语\n"
printf(”——-—-—-—---———-————-————---—--——--——----———--———-—--—---——-—-——-\n”);
for(c=0;
c〈i;
c++)
printf(”%—11s”,stu[c].num);
printf(”%-13s”,stu[c]。
name);
%-8s"
,stu[c].sex);
%—16s"
,stu[c]。
printf(”%-6d”,stu[c]。
%—6d"
,stu[c].sx);
%-4d”,stu[c].yy);
\n"
-——-—--——--—----—-—-—-——-———--—-—-——---————--———--———-—-—--—-—--\n”);
voidcx()
intcount=0;
charstr[10];
\n请输入要查询的学生学号:
cin〉〉str;
while(count<
i)
if(strcmp(str,stu[count].num)==0)
—----—-—-——-—-——-—---—--—-----—--——--—-—-——-———-———----——----—--\n”);
printf(”%-11s"
stu[count]。
printf(”%-13s”,stu[count].name);
%—8s"
,stu[count]。
sex);
%—16s"
,stu[count].clas);
%-6d”,stu[count].yw);
%-6d”,stu[count]。
printf(”%—4d"
printf(”\n”);
printf(”——-——-——-----—-———————--————---—-——--—---——---—-——--—-—--——--———\n”);
if(count〉=i)
printf(”\n无该学号学生”);
voidtjpjf()
intcount=0;
stu[i]。
ave=float((stu[i].yw+stu[i]。
sx+stu[i]。
yy)/3。
学号姓名平均分\n”);
—----—-—--—--—--—-----——---——----——-——--—----—-—--\n"
for(j=0;
j<
i;
j++)
while(count<
for(j=0;
i;
%—21s”,stu[count].num);
printf(”%-21s"
stu[count]。
%—6.2f"
stu[count].ave);
printf(”\n"
——--—--——--—-—--—-—----——-———---—-—-———-——-----—--\n"
voidtjbhgrs()
intj,count=0;
有不及格科目的学生是:
\n”);
printf(”学号姓名性别班级语文数学英语\n”);
——--——---———-——---———-----—-—--——--------—--—--—--—-————-——-————\n"
for(j=0;
if(stu[j].yw<
60||stu[j].sx<
60||stu[j]。
yy〈60)
{printf("
%-11s"
,stu[count].num);
printf(”%-13s”,stu[count]。
printf(”%—8s”,stu[count].sex);
printf(”%—16s”,stu[count]。
clas);
printf(”%-6d”,stu[count].yw);
printf(”%-6d”,stu[count].sx);
printf(”%—4d"
,stu[count].yy);
printf(”\n"
printf(”——-—-————-----—————---——---————————-——--—--—-—-—-——-—-—————-----\n”);
voidtj()
charx;
\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n”);
printf(”\t1.统计平均分2。
统计不及格学生信息3。
返回\n”);
\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n”);
\n\t请选择具体的统计内容:
switch(x)
case'
1'
:
tjpjf();
break;
2'
:
tjbhgrs();
bre