6-10 按等级统计学生成绩 (20分)

int set_grade( struct student *p, int n )
{
    int count=0,i,j,k;
    for(i=0;i<n;i++)
    {
        if(p[i].score>=85){
            p[i].grade='A';
        }
        else if(p[i].score>=70){
            p[i].grade='B';
        }
        else if(p[i].score>=60){
            p[i].grade='C';
        }
        else{
            p[i].grade='D';
            count++;
        }
    }
    return count;
}
发布了43 篇原创文章 · 获赞 13 · 访问量 1668

猜你喜欢

转载自blog.csdn.net/Angesthan/article/details/103687700