编写函数,将一个小写字母转换为大写字母,在主函数中调用该函数,并输出结果

如题所述

#include <stdio.h>
char to_upper(char c)
{
    if(c>='a' && c<='z') c-=32;
    return c;
}

void main()
{
    int c = getchar();
    putchar(to_upper(c));
}追问

upper是什么意思?

追答

大写字母。
这里只是一个函数名
改成什么都可以。

追问

嗯哦

温馨提示:答案为网友推荐,仅供参考