#include<iostream>
#include<cmath>
using namespace std;
int main()
{
char ch;
cin>>ch;
if(ch>='0' && ch<='9')
cout<<0<<endl;
else if(ch>='A' && ch<='Z')
cout<<1<<endl;
else if(ch>='a' && ch<='z')
cout<<2<<endl;
else
cout<<-1<<endl;
return 0;
}
5百分制成绩转五分制成绩(10分)
题目内容:
编写程序,输入百分制的分数(非负整数),将其转换为5分制成绩,成绩对应关系如下:
90-100: 5
80-89: 4
70-79: 3
60-69: 2
10-59: 1
0-9: 0
输入:非负整数
输出:[0,5]之间的整数
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int grade;
cin>>grade;
switch (grade/10)
{
case 10:
cout<<5<<endl;
break;
case 9:
cout<<5<<endl;
break;
case 8:
cout<<4<<endl;
break;
case 7:
cout<<3<<endl;
break;
case 6:
cout<<2<<endl;
break;
case 5:
cout<<1<<endl;
break;
case 4:
cout<<1<<endl;
break;
case 3:
cout<<1<<endl;
break;
case 2:
cout<<1<<endl;
break;
case 1:
cout