#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int Change(char b)
{
if (b >=‘A’&&b<=‘Z’)
{
return 1;
}
else if (b >= ‘a’ && b <= ‘z’)
{
return 2;
}
else if (b >= ‘0’&&b <= ‘9’)
{
return 3;
}
else
{
return 4;
}
}
int main()
{
char a;
while (1)
{
a=getchar();
int c = Change(a);
if (c == 1)
{
printf("%c", a + 32);
continue;
}
if (c == 2)
{
printf("%c", a - 32);
continue;
}
if (c == 3)
{
continue;
}
if (c == 4)
{
printf("%c", a);
}
}
system("pause");
return 0;
}
本文介绍了一个简单的字符转换程序,该程序能将输入的字符转换为小写、大写或保持不变,具体取决于字符的类型。它使用C语言实现,通过定义函数Change来判断字符类别并进行相应转换。
346

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



