Kerugaki-Blog Park http://www.cnblogs.com/kailugaji/
Method 1:
1#include <stdio.h>2#include <stdlib.h>3 //uppercase and lowercase letters separated by 32 digits4 voidMain () {5 Charch,t;6printf"Please input a letter:\n");7Ch=GetChar ();8T=getchar ();//Absorbing Enter9 Ten while((ch<'A'&& ch>'Z') || (ch<'Z'&& ch>'a')){ Oneprintf"input Error!\nplease input again:\n"); ACh=GetChar (); - } - the if(Ch & +) -Ch=ch &223;//make fifth bit 0, capitalize - ElseCh=ch | +;//make fifth bit 1, lowercase - + Putchar (CH); -printf"\ n"); +}
Method 2:
1#include <stdio.h>2#include <stdlib.h>3 //uppercase and lowercase letters separated by 32 digits4 voidMain () {5 Charch;6printf"Please input a letter:\n");7scanf"%c",&ch);8Ch= (ch>='A'&& ch<='Z')? (ch+ +):((ch>='a'&& ch<='Z')? (ch- +):p rintf ("Input error!"));9printf"%c\n", ch);Ten}
The result is:
C language uppercase and lowercase letters conversion