编写程序C语言 从键盘输入一个字符,判断是字母,数字,还是其它字符
4个回答
推荐于2017-09-28
展开全部
#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");
}
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 "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<stdio.h>
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");}
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");}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询