https://pintia.cn/problem-sets/12/problems/349
1 int set_grade(struct student *p, int n) 2 { 3 int i, count; 4 5 count = 0; 6 for (i = 0; i < n; i++) 7 { 8 if ((p + i)->score >= 85) 9 { 10 (p + i)->grade = ‘A‘; 11 } 12 else if ((p + i)->score >= 70) 13 { 14 (p + i)->grade = ‘B‘; 15 } 16 else if ((p + i)->score >= 60) 17 { 18 (p + i)->grade = ‘C‘; 19 } 20 else 21 { 22 (p + i)->grade = ‘D‘; 23 } 24 25 if ((p + i)->score < 60) 26 { 27 count++; 28 } 29 } 30 31 return count; 32 }
原文地址:https://www.cnblogs.com/2018jason/p/12205198.html
时间: 2024-11-05 17:29:28