當前位置:編程學習大全網 - 網站源碼 - c語言編程,從鍵盤任意按下壹個鍵程序能識別並輸出按鍵種類

c語言編程,從鍵盤任意按下壹個鍵程序能識別並輸出按鍵種類

#include<stdio.h>

#include<conio.h>

void main() { char c;

while ( 1 ) {

c=getch();

if ( c==27 ) { printf("Esc鍵退出。\n"); break; }

else if ( c>='a' && c<='z' ) printf("小寫字母\n");

else if ( c>='A' && c<='Z' ) printf("大寫字母\n");

else if ( c>='0' && c<='9' ) printf("數字\n");

else printf("其他字符\n");

}

}

  • 上一篇:騰訊TGP是什麽
  • 下一篇:13張麻將是多少張?
  • copyright 2024編程學習大全網