6-2. 字符串字母大小写转换(10)

来源:互联网 发布:网络组策略开启端口 编辑:程序博客网 时间:2024/05/18 03:52
#include <stdio.h>#include <ctype.h>#define STRING_SIZE 40int main() {int i = 0;char str[STRING_SIZE + 1] ;gets(str);while(str[i] != '#') {if(str[i]>=97 && str[i]<=122)str[i] = str[i] - 32 ;else if(str[i]>=65 && str[i]<=90)str[i] = str[i] + 32 ;++i;}str[i] = '\0';printf("%s\n", str);//char a ;//scanf("%c",&a);//printf("%d",a-32);return 0;}

0 0
原创粉丝点击