CZ中学每学期都会给学生提供丰厚的奖学金但是要想获得这些奖学金也不是一件容易的事情。CZ中学对学生成绩的评定一共有A、B、C、D共4个等级提供的奖学金有如下几种:A 竞赛奖学金 提供给至少在一门学科竞赛中获得省级一等奖以上奖项并且语数英三门课的成绩被评定为A或B而且还是三好学生的同学奖金3000元 B 华英奖学金 提供给至少在一门学科竞赛中获得全省前20名的同学奖金2000元C 优秀三好学生奖学金
#include
int main() { string grades; int competition[5]; char isExcellent; char isPoor;
// 输入成绩信息
cin >> grades;
// 输入竞赛成绩
for (int i = 0; i < 5; i++) {
cin >> competition[i];
}
// 输入是否是三好学生
cin >> isExcellent;
// 输入是否是贫困生
cin >> isPoor;
// 计算奖学金金额
int scholarship = 0;
// 判断是否符合竞赛奖学金的条件
if ((competition[0] == 1 || competition[0] == 0) && (grades[0] == 'A' || grades[0] == 'B') && isExcellent == 'Y') {
scholarship = max(scholarship, 3000);
}
// 判断是否符合华英奖学金的条件
for (int i = 0; i < 5; i++) {
if (competition[i] == 0) {
scholarship = max(scholarship, 2000);
break;
}
}
// 判断是否符合优秀三好学生奖学金的条件
if (grades[0] == 'A' && grades[1] == 'A' && grades[2] == 'A' && grades[3] == 'A' && grades[4] == 'A') {
scholarship = max(scholarship, 1000);
}
// 判断是否是贫困生
if (isPoor == 'Y') {
scholarship = 3000;
}
// 输出奖学金金额
cout << scholarship << endl;
return 0;
原文地址: http://www.cveoy.top/t/topic/iIx1 著作权归作者所有。请勿转载和采集!