题解 | #判断是不是字母#
判断是不是字母
https://www.nowcoder.com/practice/91a588dd4cd244bfa616f17603ec123c
#include <stdio.h>
int main()
{
char input=0;
while((input=getchar())!=EOF)//判断每次输入是否有效
{
if(('a'<=input&&input<='z')||('A'<=input&&input<='Z'))//判别
{
printf("%c is an alphabet.\n",input);
}
else{
printf("%c is not an alphabet.\n",input);
}
getchar();//吃掉输入的字符
}
return 0;
}
查看25道真题和解析