成績轉換 HDU - 2004

水蛙族的希望°發表於2020-11-11

成績轉換 HDU - 2004

C

#include<stdio.h>
int main()
{
	int t;
	while(scanf("%d", &t) != EOF)
	{
		if(0 <= t && t <= 59) printf("E\n");
		else if(60 <= t && t <= 69) printf("D\n");
		else if(70 <= t && t <= 79) printf("C\n");
		else if(80 <= t && t <= 89) printf("B\n");
		else if(90 <= t && t <= 100) printf("A\n");
		else printf("Score is error!\n");
	}
	return 0;
}

C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int g;
	while(cin >> g)
	{
		if(g <= 100 && g >= 90) cout << "A" << endl;
		else if(g < 90 && g >= 80) cout << "B" << endl;
		else if(g < 80 && g >= 70) cout << "C" << endl;
		else if(g < 70 && g >= 60) cout << "D" << endl;
		else if(g < 60 && g >= 0) cout << "E" << endl;
		else cout << "Score is error!" << endl;
	}
	return 0;
}

相關文章