调用toupper()函数
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
void toupper(char ch)
{
if (ch >= 'a'&&ch <= 'z')
{
printf("%c\n", ch - 32);
}
else
{
printf("%c\n", ch + 32);
}
}
int main()
{
char ch;
scanf("%c", &ch);
toupper(ch);
system("pause");
return 0;
}
随机输入大写字母,程序输出小写字母或者随机输入小写字母,程序输出大写字母
本文提供了一个简单的C语言程序实例,展示了如何使用toupper函数将小写字母转换为大写字母,反之亦然。通过输入一个字符,程序能够判断其大小写并进行相应的转换。
2801

被折叠的 条评论
为什么被折叠?



