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

来源:互联网 发布:mac os x 10.12懒人版 编辑:程序博客网 时间:2024/05/17 02:14
#include <ctype.h>#include <stdio.h>int main(){        char a[41];        int b = 0, c, d;        a[b] = getchar();        while (a[b] != '#')        {                if (islower(a[b]))                {                        a[b]= toupper(a[b]);                }                else if (isupper(a[b]))                {                        a[b] = tolower(a[b]);                }                b++;                a[b] = getchar();        }        for (c = 0; c < b; c++)        {                printf("%c", a[c]);        }}


0 0
原创粉丝点击