比较字母大小
时间限制:
3000 ms | 内存限制:
65535 KB
难度:
1
-
描述
-
任意给出两个英文字母,比较它们的大小,规定26个英文字母A,B,C.....Z依次从大到小。
代码:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
getchar(); //吸收换行符;
char n,m;
scanf("%c %c",&n,&m); //注意:%c %c之间的空格;
if(n>m)
printf("%c<%c\n",n,m);
if(n==m)
printf("%c=%c\n",n,m);
if(n<m)
printf("%c>%c\n",n,m);
}
return 0;
}
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
getchar(); //吸收换行符;
char n,m;
scanf("%c %c",&n,&m); //注意:%c %c之间的空格;
if(n>m)
printf("%c<%c\n",n,m);
if(n==m)
printf("%c=%c\n",n,m);
if(n<m)
printf("%c>%c\n",n,m);
}
return 0;
}