代码如下
#include
int main(){
char ch;
scanf("%c",&ch);
if(ch>='a'&&ch<='z'){
ch -= 32;
}else if(ch>='A'&&ch<='Z'){
ch += 32;
}
printf("%c",ch);
return 0;
}
package king;
import java.util.Scanner;
public class qq {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("请输入一个字符");
String s=sc.next();
char c[]=s.toCharArray();
if((c[0]>='A')&&(c[0]<='Z'))
{
System.out.println((char)(c[0]+32));
}
else if((c[0]>='a')&&(c[0]<='z'))
{
System.out.println((char)(c[0]-32));
}
else
{
System.out.println("输入错误");
}
}
}
#include
#include
void main ()
{
char c1,c2;
printf("input!\n");
c1=getchar();
if (c1>='a'&&c1<='z')
{c2=c1-32;}
else
{ c2=c1+32;}
printf("output=%c\n",c2 );
}
Dd Yy Hh Ll Gg Jj Pp Qq Xx Vv Kk Tt