ASCII搞定abcd

softman 发表于 2年前 · 关联问题 分数转换

include

include<stdio.h>

include

include<string.h>

include<ctype.h>

using namespace std;

int main() {

int score = 77; cin >> score; if (score == 100) cout << 'A'; else if (score < 60) cout << 'E'; else printf("%c", 'D' - (score - 60) / 10); return 0;

}

如图,只有两种特殊情况,一种是刚好等于100,另一种是没到60分,做个判断就好,其他没有必要else if了,直接用ASCII出结果