大小写转换
Time Limit: 1000MS
Memory Limit: 65536KB
Problem Description
X现在要学习英文以及各种稀奇古怪的字符的了。现在他想把一串字符中的小写字母变成大写字符,大写字母变成小写字母,其他的保持不变。
Input
输入有多组。
每组输入一个字符串,长度不大于80,不包含空格。
Output
输出转换后的字符串
#include<stdio.h>
int main()
{
char a[10000], c;
int i = 0, k = 1, m = 0;
while (gets(a) != NULL)
{
for (i = 0; a[i] != '\0'; i++)
{
if (a[i] >= 'a'&&a[i] <= 'z')
{
printf("%c", a[i] - 32);
}
else if (a[i] >= 'A'&&a[i] <= 'Z')
{
printf("%c", a[i] + 32);
}
else
{
printf("%c", a[i]);
}
}
putchar('\n');
}
}
Example Input
A* B+
Example Output
a* b+
本文介绍了一个简单的程序,该程序能够将输入字符串中的小写字母转换为大写,大写字母转换为小写,同时保持其他非字母字符不变。程序使用C语言实现,并通过示例展示了其工作原理。
2043

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



