用ASCII码判断就行,一个字符对应一个整型数,或调用库函数ctype
#include "stdio.h"
void main()
{
char temp;
temp=getch();
if(temp>='a'&&temp<='z')
printf("xiao xie zi mu");
else if(temp>='A'&&temp<='Z')
printf("da xie zi mu");
if(temp>='0'&&temp<='9')
printf("shuzi");
else printf("other zi mu");
}
#include "stdio.h"
#include "bios.h"
#include "ctype.h"
main(){
int key;
key=bioskey(0);
if(isalnum(key&0xff)){
if(((char)key>='a'&&(char)key<='z')||((char)key>='A'&&(char)key<='Z'))
printf("you input a char.\n");
else
printf("you input a number.\n");
}
else
printf("you input a teshu zifu.");
getch();
}
#include
main()
{char c;
c=getchar()
if(c>='a'&&c<='z'||c>='A'&&c<='Z')
printf("it is ");
else if(c>='0'&&c<='9')
printf("it is a number");
else printf("it is others");}