题解 | #判断是不是字母#
判断是不是字母
https://www.nowcoder.com/practice/91a588dd4cd244bfa616f17603ec123c
我以大一初学者的视角编写,虽有不足,但容易理解
#include <stdio.h> int main() { char num; while (scanf("%c", &num) != EOF) { getchar();//换行但不结束输入 if(num>='a'&&num<='z') { printf("%c is an alphabet.\n",num); } else if (num>='A'&&num<='Z') { printf("%c is an alphabet.\n",num); } //判断字母 else { printf("%c is not an alphabet.\n",num); } //判断非字母 } return 0; }