复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include<string.h> #include<stdio.h> #include<ctype.h> char a[101],b[101]; int main (){ int c; gets(a); gets(b); for (int i = 0;i < strlen(a);i ++) { a[i] = toupper (a[i]); b[i] = toupper (b[i]); } //printf("%sn%sn",a,b); if (strcmp(a,b) > 0) c = 1; else if (strcmp(a,b) == 0) c = 0; else c = -1; printf("%d",c); return 0; }
先把两个字符串大小写统一,这里使用 toupper() :
头文件: ctype.h
定义: int toupper (int a); < 换成大写>
int tolower(int a); < 换成小写>
有一点定义不清: 负数在判断时 是 true.
最后
以上就是想人陪斑马最近收集整理的关于CF 339A的全部内容,更多相关CF内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复