| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 138565 | Kevin | 31忽略大小写的字符串比较 | C++ | Accepted | 0 MS | 264 KB | 699 | 2025-11-28 10:50:54 |
#include <iostream> #include <cstring> #include <cctype> using namespace std; int main() { char s1[100], s2[100]; // 使用安全的fgets替代gets fgets(s1, sizeof(s1), stdin); fgets(s2, sizeof(s2), stdin); // 去除换行符 s1[strcspn(s1, "\n")] = 0; s2[strcspn(s2, "\n")] = 0; // 转换为小写 for(int i = 0; s1[i]; i++) { s1[i] = tolower(s1[i]); } for(int i = 0; s2[i]; i++) { s2[i] = tolower(s2[i]); } int n = strcmp(s1, s2); if(n == 0) { cout << '='; } else if(n > 0) { cout << '>'; } else { cout << '<'; } return 0; }