listd05.c

来自「c21Examples.rar」· C语言 代码 · 共 40 行

C
40
字号
/*=======================================================*
 * Program: listD05.c
 * Purpose: This program may not be portable due to the  *
 *          way it uses character values.                *
 *=======================================================*/
#include <stdio.h>
int main(void)
{
  unsigned char x = 0;
  char trash[256];               /* used to remove extra keys */
  while( x != 'Q' && x != 'q' )
  {
     printf( "\n\nEnter a character (Q to quit) ==> " );

     x = getchar();

     if( x >= 'A' && x <= 'Z')
     {
        printf( "\n\n%c is a letter of the alphabet!", x );
        printf("\n%c is an uppercase letter!", x );
     }
     else
     {
        if( x >= 'a' && x <= 'z')
        {
           printf( "\n\n%c is a letter of the alphabet!", x );
           printf("\n%c is a lowercase letter!", x );
        }
        else
        {
           printf( "\n\n%c is not a letter of the alphabet!", x );
        }
     }
     gets(trash); /* eliminates enter key */
  }
  printf("\n\nThank you for playing!\n");
  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?