lg空调售后服务:输入一个字符若小写输出大写,若大写输出小写,若其他字符原样输出!

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/01 01:29:46
是C语言的,各位帮一下忙吧!

楼上的搞错了吧,你的是C++。
以下是C语言源程序:
#include "stdio.h"
#include "conio.h"

main()
{
char c=getchar();
if(c>='A'&&c<='Z')
{
c=c+32;
printf("The Lower Letter: %c",c);
}
else if(c>='a'&&c<='z')
{
c=c-32;
printf("The Upper Letter: %c",c);
}
else
{printf("The Original Letter: %c",c); }

getch();
}

void main()
{
char c=getchar();
if(c>='A'&&c<='Z')
c=c+32;
else if(c>='a'&&c<='z')
c=c-32;
else
cout<<c<<endl;
cout<<c;
}