游客 Signup | Login
中文 | En

1412 - C语言-分数换算

给出一百分制成绩,要求输出成绩等级‘A’、‘B’、‘C’、‘D’、‘E’。 90分以上为A 80-89分为B 70-79分为C 60-69分为D 60分以下为E

Input

一个整数0-100以内

Output

一个字符,表示成绩等级

Examples

Input

90

Output

A

Hint

分段函数返回字符

Solution C

#include<stdio.h>
void main()
{
	int score;
	char ans;
	scanf("%d",&score);
	if(90<=score)
		ans='A';
	else if(80<=score&&score<90)
		ans='B';
	else if(70<=score&&score<80)
		ans='C';
	else if(60<=score&&score<70)
		ans='D';
	else
		ans='E';
	printf("%c\n",ans);
}

Solution C++

#include<iostream>
#include<iomanip>
#include<fstream>
#include<string> 
#include<climits>
#include<cctype>
#include<cmath>
#include<cstring>
using namespace std;

int main()
{
 //ifstream cin("aaa.txt");
  int i,j,n,m,k,sum,p,len,a[10001],l,count;
  
  int x,y;
  string s,b[1000];
  cin>>x;
  if(x>=90) cout<<'A';
  else if(x>=80) cout<<'B';
  else if(x>=70) cout<<'C';
  else if(x>=60) cout<<'D';
  else cout<<'E';
  

  	return 0;

}

Hint

分段函数返回字符

Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题