欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

玩欧卡就用莱仕达V10方向盘欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 1878|回复: 0
收起左侧

判断一个字符是否为数字字符

[复制链接]
起名字最烦了 发表于 2011-11-10 20:37 | 显示全部楼层 |阅读模式
//入门题目:判断一个字符是否为数字字符
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

int IsChar(char ch);

int main()
{
char ch;
while(1)
{
printf("\n请输入一个字符(ctrl+z退出)\n");
ch=getch();
printf("%c\n",ch);
if(IsChar(ch))
printf("是数字字符\n");
else
printf("不是数字字符\n");
if(ch==26)
break;
}
system("pause");
return 0;
}

int IsChar(char ch)
{
if(ch>='0'&&ch<='9')
return 1;
else
return 0;
}

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-4-26 01:34 , Processed in 0.032279 second(s), 7 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表