题目大意
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsICM38FdsYkRGZkRG9lcvx2bjxiNx8VZ6l2cs0TPB1UMNR1T5VFROBDOsJGcohVYsR2MMBjVtJWd0ckW65UbM5WOHJWa5kHT20ESjBjUIF2X0hXZ0xCMx81dvRWYoNHLrdEZwZ1Rh5WNXp1bwNjW1ZUba9VZwlHdssmch1mclRXY39CXldWYtlWPzNXZj9mcw1ycz9WL49zZuBnLxADN2IjMwQTM5IzMwAjMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
标签:字符串,大小写
点击进入题目
完整代码
/*
strcmp(char* s1, char*s2)区分大小写比较函数
stricmp(char* s1, char*s2)不区分大小写比较函数
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
string str1, str2;
cin >> str1 >> str2;
if (str1.size() != str2.size()) {//判断长度是否相等,不等为第一种情况
cout << "1" << endl;
}
else {
if (strcmp(str1.c_str(),str2.c_str())==0){//若长度相等,判断是否是完全一样的字符串,完全一样为第二种情况
cout << "2" << endl;
}
else {
if (_stricmp(str1.c_str(), str2.c_str())==0) {//如果不完全一样,则不区分大小写看是否一样,不区分大小写一样为第三种情况
cout << "3" << endl;
}
else {//都不是为第四种情况
cout << "4" << endl;
}
}
}
}