C++函数isacscii
来源:互联网 发布:ubuntu手机远程控制 编辑:程序博客网 时间:2024/05/22 17:38
功能:
判断输入文字是否为有效的ASCII 字符。
所在函数库:ctype.h
语法:
#include<ctype.h>
int isascii(int c)
函数返回值:当c的低位字节在0~127范围内(0x00~0x7f),返回非零值.
#include<iostream.h>
#include<ctype.h>
int main()
{
char c1='@';
char c2='a';
if (isalpha (c1)!=0 )
cout<<c1<<" is the ASCII character!"<<endl; //当c1为有效的ASCII字符时,打印信息
else
cout<<c1<<" is not the ASCII character!"<<endl; //当c1为非有效的ASCII字符时,打印信息
if (isalpha (c2)!=0 )
cout<<c2<<" is the ASCII character!"<<endl; //当c1为有效的ASCII字符时,打印信息
else
cout<<c2<<" is not the ASCII character!"<<endl; //当c1为非有效的ASCII字符时,打印信息
return 0;
}
运行结果:
@ is the ASCII character!
A is the ASCII character!
判断输入文字是否为有效的ASCII 字符。
所在函数库:ctype.h
语法:
#include<ctype.h>
int isascii(int c)
函数返回值:当c的低位字节在0~127范围内(0x00~0x7f),返回非零值.
#include<iostream.h>
#include<ctype.h>
int main()
{
char c1='@';
char c2='a';
if (isalpha (c1)!=0 )
cout<<c1<<" is the ASCII character!"<<endl; //当c1为有效的ASCII字符时,打印信息
else
cout<<c1<<" is not the ASCII character!"<<endl; //当c1为非有效的ASCII字符时,打印信息
if (isalpha (c2)!=0 )
cout<<c2<<" is the ASCII character!"<<endl; //当c1为有效的ASCII字符时,打印信息
else
cout<<c2<<" is not the ASCII character!"<<endl; //当c1为非有效的ASCII字符时,打印信息
return 0;
}
运行结果:
@ is the ASCII character!
A is the ASCII character!
- C++函数isacscii
- [C/C++]C函数
- c 函数
- C函数
- C 函数
- C函数
- 【C++】函数
- C 函数
- C++:函数
- C函数
- [C++]函数
- C函数
- c 函数
- C函数
- [C++]函数
- C函数
- 【c++】函数
- 【C++】函数
- 第12周 上机报告 1之练习3 回文日
- Ubuntu解决gedit warning问题的方法
- 利用已有数据库配合ASP.NET2.0内置用户 角色 授权系统打造自己的权限分配程序(2)
- 布局--霓虹灯的实现
- 地理(投影)坐标与屏幕坐标的转换!
- C++函数isacscii
- Android应用开发之FrameLayout (帧布局)+小鸟飞翔案例
- ubuntu屏幕截图工具:scrot,可截鼠标拖曳的矩形区域图形
- MFC程序逆向 – 消息篇
- 关于hibernate数据库设计字段默认值
- c#小工具,位序批量转换工具,hex到hex。bit order converter,hex to hex
- ADO数据库访问技术
- 实现js的replaceAll方法
- Linux文件