# include
# include
# include
# include
struct Student #自定义结构体
{
int number;
char name[10];
int phy;
int math;
int eng;
int com;
}stu[40];
int choose_carte() #菜单显示
{ int c;
do{ system("cls");
printf("\t\t*********请选择该学生成绩统计系统所实现功能*********\n");
printf("\t\t*1.录入:输入学生数据 *\n");
printf("\t\t*2.显示:显示学生数据 *\n");
printf("\t\t*3.统计:统计最高分,最低分 *\n");
printf("\t\t*0.退出 *\n");
printf("\t\t****************************************************\n");
printf("\t\t\tGive you Choice(0-3):");
scanf("%d",&c);
}while(c<0||c>3);
return c;
}
int Intput(struct Student stu[],int n) #输入学生信息
{
int i=0;
char c;
do
{
printf("\t\t\t学号:");
scanf("\t\t\t%d",&stu[n+i].number);
printf("\t\t\t姓名:");
scanf("\t\t\t%s",&stu[n+i].name);
printf("\t\t\t物理分数:");
scanf("\t\t\t%d",&stu[n+i].phy);
printf("\t\t\t数学分数:");
scanf("\t\t\t%d",&stu[n+i].math);
printf("\t\t\t外语分数:");
scanf("\t\t\t%d",&stu[n+i].eng);
printf("\t\t\t计算机分数:");
scanf("\t\t\t%d",&stu[n+i].com);
i++;
printf("\t\t\t您还要继续录入成绩吗?\n");
printf("\t\t\t请输入‘y’继续,或'n'停止");
scanf("\t\t\t%c",&c);
}while(c=='y');
return (i+n);
}
int Output(struct Student stu[],int n) #输出学生信息
{
int i;
printf("\t\t----------------------------------------------------\n");
printf("\t\t| Number | Name | Phy | Math | Eng | Com | \n");
printf("\t\t----------------------------------------------------\n");
for( i=1;istu[i].phy)
phy_low=i;
if(stu[i].phy<60)
printf("\t\t物理不及格的%4d%10s%9d\n",stu[i].number,stu[i].name,stu[i].phy);
if(stu[math_hight].mathstu[i].math)
math_low=i;
if(stu[i].math<60)
printf("\t\t数学不及格的%4d%10s%9d\n",stu[i].number,stu[i].name,stu[i].math);
if(stu[eng_hight].engstu[i].eng)
eng_low=i;
if(stu[i].eng<60)
printf("\t\t英语不及格的%4d%10s%9d\n",stu[i].number,stu[i].name,stu[i].eng);
if(stu[com_hight].comstu[i].com)
com_low=i;
if(stu[i].phy<60)
printf("\t\t计算机不及格的%4d%10s%9d\n",stu[i].number,stu[i].name,stu[i].com);
++sum;
}
printf("\t\t该数据中不及格的人数为%d\n",sum);
system("pause");
printf("\t\t物理最高分为:\n");
printf("\t\t%4d%10s%9d\n",stu[phy_hight].number,stu[phy_hight].name,stu[phy_hight].phy);
printf("\t\t数学最高分为:\n");
printf("\t\t%4d%10s%9d\n",stu[math_hight].number,stu[math_hight].name,stu[math_hight].math);
printf("\t\t外语最高分为:\n");
printf("\t\t%4d%10s%9d\n",stu[eng_hight].number,stu[eng_hight].name,stu[eng_hight].eng);
printf("\t\t计算机最高分为:\n");
printf("\t\t%4d%10s%9d",stu[com_hight].number,stu[com_hight].name,stu[com_hight].com);
printf("\n\n\n");
printf("\t\t物理最低分为:\n");
printf("\t\t%4d%10s%9d\n",stu[phy_low].number,stu[phy_low].name,stu[phy_low].phy);
printf("\t\t数学最低分低为:\n");
printf("\t\t%4d%10s%9d\n",stu[math_low].number,stu[math_low].name,stu[math_low].math);
printf("\t\t外语最低分为:\n");
printf("\t\t%4d%10s%9d\n",stu[eng_low].number,stu[eng_low].name,stu[eng_low].eng);
printf("\t\t计算机最低分为:\n");
printf("\t\t%4d%10s%9d\n",stu[com_low].number,stu[com_low].name,stu[com_low].com);
system("pause");
}
void main()
{
int n=0;
do{
switch(choose_carte())
{
case 0:
break;
case 1:
printf("\t\t\t请输入学生的个人信息\n");
n=Intput(stu,n);
break;
case 2:
printf("\t\t\t输出所有学生的个人信息\n");
Output(stu,n);
break;
case 3:
Data(stu,n);
break;
}
}while(choose_carte()!=0);
}