C语言大作业学生成绩查询系统源代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
#include
#include
struct student
{
char name[20];
char speciality[10];
int C;
int math;
int English;
int PE;
int Chinese;
}
student[13]={
{"zhangting","通信工程",85,80,90,80,88},
{"zhangsan","通信工程",90,91,89,87,88},
{"wangwu","通信工程",90,90,90,90,90},
{"zhouyue","通信工程",90,89,98,88,90},
{"zhangjiabang","通信工程",88,98,90,90,88},
{"tianfu","通信工程",90,97,86,87,56},
{"wudong","通信工程",89,87,86,85,84},
{"luhuiping","通信工程",87,81,90,80,81},
{"zhafengyun","通信工程",90,89,87,86,85},
{"wulin","通信工程",90,90,89,81,72},
{"wangyun","通信工程",87,78,69,89,90},
{"yangyu","通信工程",90,78,67,82,83},
{"lili","通信工程",80,86,83,84,78}};
void main()
{
struct student *p;
p=student;
int i,j,temp,sum,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0,sum6=0,count=0;
double ave1,ave2,ave3,ave4,ave5,ave6;
char xname[10];
printf("\t**********学生成绩查询系统**********\t");
printf("\n请务必确认你输入的名字是正确的,否则将无法输出你的个人成绩,只能显示班内的成绩总况\n");
printf("你的名字是:");
scanf("%s",xname);
printf("你的专业是通信工程\n");
for(i=0;i<13;i++,p++)
if(strcmp(xname,p->name)==0)
{ printf("你的各科成绩如下:");
printf("\n C:%d",(*p).C);
printf("\n math:%d",(*p).math);
printf("\n English:%d",(*p).English);
printf("\n PE:%d",(*p).PE);
printf("\n Chinese:%d\n",(*p).Chinese);
sum1=(*p).C+(*p).math+(*p).English+(*p).PE+(*p).Chinese;
ave1=sum1/5.0;
printf("\n你的总分为:%d\n平均分为:%f\n",sum1,ave1);
}
{
for(i=0;i<13;i++)
sum2=sum2+student[i].C;
ave2=sum2/13.0;
printf("\nC语言的总分为:%d\n平均分为:%f\n",sum2,ave2);
}
{
for(i=0;i<13;i++)
sum3=sum3+student[i].math;
ave3=sum3/13.0;
printf("\n数学的总分为:%d\n平均分为:%f\n",sum3,ave3);
}
{
for(i=0;i<13;i++)
sum4=sum4+student[i].English;
ave4=sum4/13.0;
printf("\n英语的总分为:%d\n平均分为:%f\n",sum4,ave4);
}
{
for(i=0;i<13;i++)
sum5=sum5+student[i].PE;
ave5=sum5/13.0;
printf("\n体育的总分为:%d\n平均分为:%f\n",sum5,ave5);
}
{
for(i=0;i<13;i++)
sum6=sum6+student[i].Chinese;
ave6=sum6/13.0;
printf("\n语文的总分为:%d\n平均分为:%f\n",sum6,ave6);
}
{
for(i=0;i<13;i++)
if(student[i].C<60)
count+=1;
printf("\nC语言不及格人数为%d\n",count);
}
{
if(student[i].math<60)
count+=1;
printf("\n数学不及格人数为%d\n",count);} {
for(i=0;i<13;i++)
if(student[i].English<60)
count+=1;
printf("\n英语不及格人数为%d\n",count);
}
{
for(i=0;i<13;i++)
if(student[i].PE<60)
count+=1;
printf("\n体育不及格人数为%d\n",count);
}
{
for(i=0;i<13;i++)
if(student[i].Chinese<60)
count+=1;
printf("\n语文不及格人数为%d\n",count);
}
for(i=0;i<13;i++)
for(j=i+1;j<13;j++)
if(student[i].C { temp=student[i].C; student[i].C=student[j].C; student[j].C=temp; } printf("\nC语言的成绩由高到低排列为:\n"); for(i=0;i<13;i++) printf("%4d",student[i].C); for(i=0;i<13;i++) for(j=i+1;j<13;j++) if(student[i].math { temp=student[i].math; student[i].math=student[j].math; student[j].math=temp; } printf("\n数学的成绩由高到低排列为:\n"); for(i=0;i<13;i++) printf("%4d",student[i].math);