c语言 11-7

1、

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

void str_toupper(char *s)
{
    while(*s)
    {
        *s = toupper(*s);
        s++;
    }
}

void str_tolower(char *s)
{
    while(*s)
    {
        *s = tolower(*s);
        s++;
    }
}

int main(void)
{
    char str[128];
    printf("str: "); scanf("%s", str);
    
    str_toupper(str);
    printf("upper result: %s
", str);
    
    str_tolower(str);
    printf("lower result: %s
", str);
    
    return 0;
}

原文地址:https://www.cnblogs.com/liujiaxin2018/p/14839015.html