该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
scanf("%s",s.name);
printf("请输入学生的性别:");
scanf("%s",s.sex);
printf("请输入学生的班级:");
scanf("%s",s.grade);
printf("请输入学生的成绩(至少3门):");
scanf("%d",&s.score);
students[Count]=s;
Count++;
return;
}
/*查询学生资料*/
void search_student(struct students_list students[],char*num)
{
int i,flag=0;
if(Count==0)
{
printf("学生成绩系统是空的!\n");
return;
}
for (i=0;i
if(strcmp(num,students[i].num)==0)
{
flag=1;
break;
}
if(flag==1)
{
printf("学号:%s\t",students[i].num);
printf("姓名:%s\t",students[i].name);
printf("性别:%s\t",students[i].sex);
printf("班级:%s\t",students[i].grade);
printf("成绩:%d\n",students[i].score);
}
else printf("没有此学生!");
}
/*统计平均分和不及格人数*/
void count_student(struct students_list students[])
void set_grade(struct student_list *p)
{
int i,sum=0,n=0;
float ave=0.00;
for (i=0;i
{
sum=sum+s[i].score;
}
ave=sum/i;
for(i=0;i
{
if(p->score>=90)
p->grade='A';
else if (p->score>=80)
p->grade='B';
else if (p->score>=70)
p->grade='C';
else if (p->score>=60)
p->grade='D';
else{
p->grade='E';
n++;
}
}
return 0;
}
/*排序*/
void range_student(struct students_list students[],char*num)
{
int x,y,index,temp;
struct students_list n;
for(x=0;x
{
index=x;
for(y=x+1;y
if(n[y]
index=y;
temp=n[index];
n[index]=n[x];
n[x]=temp;
}
return 0;
}