字符串运用
2023-08-15 14:54:19
发布于:上海
35阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int maxi(int a,int b){
if(a>b) return a;
if(a<b) return b;
if(a==b) return a;
}
int cmp(int m,int n){
if(m>n) return 1;
if(m<n) return 3;
}
int main(){
char a[100],b[100];
cin.getline(a,100);
cin.getline(b,100);
int chan=maxi(strlen(a),strlen(b));
for(int i=0;i<chan;i++){
if((a[i]>='A' and a[i]<='Z') and (b[i]>='a' and b[i]<='z')){
b[i]-=32;
if(cmp(a[i],b[i])==1){
cout<<">";
return 0;
}
if(cmp(a[i],b[i])==3){
cout<<"<";
return 0;
}
}
else if(a[i]>='a' and a[i]<='z' and b[i]>='A' and b[i]<='Z'){
b[i]+=32;
if(cmp(a[i],b[i])==1){
cout<<">";
return 0;
}
if(cmp(a[i],b[i])==3){
cout<<"<";
return 0;
}
}
else{
if(cmp(a[i],b[i])==1){
cout<<">";
return 0;
}
if(cmp(a[i],b[i])==3){
cout<<"<";
return 0;
}
}
}
cout<<"=";
return 0;
}
这里空空如也
有帮助,赞一个