#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[])
{
char s[] = "ak465461#@#SDAasasacjkASS"; //输入一个字符数组 字符数组里的内容;
int n = strlen(s); //调用一个strlen函数计算字符数组的长度 ;
int i;
//·················大写转小写··························;
for(i = 0; i < n; i++){
if('A' <= s[i]&&s[i] <= 'Z')
{
s[i] = s[i] + 32;
}else{
continue;
}
}
puts(s);
//··············小写转大写·····················
for(i = 0; i < n; i++){
if('a' <= s[i]&&s[i] <= 'z'){
s[i] = s[i] - 32;
}else{
continue;
}
}
puts(s);
return 0;
}
C语言: 字符串数组 大小字母的互相转换
于 2023-07-26 14:31:25 首次发布