gta5集装箱怎么吊车:C语言中判断字符型变量大小写转换的表达式

来源:百度文库 编辑:中科新闻网 时间:2024/05/03 19:51:09
其实我在做一道选择题 判断字符型变量x是否是大写字母的表达式
A、‘A’<=x<='z' B、(x>=A)&&(x<=Z) C、('A'<=x)&&('Z'=>x)
D (x>='A')&&(x<='Z')

#include<stdio.h>
#include <ctype.h>
#include <string.h>

int main(int argc, char *argv[])
{
char tmp[32];
strcpy(tmp, "hello world");
for(int i=0; i<strlen(tmp); i++)
{
if( islower(tmp[i]) )
tmp[i] = toupper(tmp[i]);
}

printf("now, tmp = %s\n", tmp);
return 0;
}

char c

大变小c+32
小变大c-32