String of uppercase and lowercase letters are interchangeable

 1 #include <stdio.h>
 2 
 3 int main()
 4 {
 5     char ch;
 6     printf("input characters:");
 7     ch = getchar();
 8     while (ch!='\n')
 9     {
10         if (ch >= 'A' && ch <= 'Z')
11         {
12             ch = ch + ('a' - 'A ' );         // ASCII encoding position 
13 is          }
 14          the else 
15          {
 16              IF (CH> = ' A ' && CH <= ' Z ' )
 . 17              {
 18 is                  CH = CH - ( ' A ' - ' A ' );
 . 19              }
 20 is          }
 21 is          the putchar (CH);
 22 is          CH = getchar ();
 23 is      }
 24  
25     return 0;
26 }

 

Guess you like

Origin www.cnblogs.com/2018jason/p/10961985.html