• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
爱白菜的小昆虫
博客园    首页    新随笔    联系   管理    订阅  订阅

c 头文件<ctype.h>(二)

测试<ctype.h>函数

 1 #include <stdio.h>
 2 #include <ctype.h>
 3 
 4 int main(){
 5     
 6     int num = 0;
 7     for(int i = 0; i < 256; ++i){
 8         if(isalnum(i)){
 9             printf("%d\t'%c'\t", i, i);
10             ++num;
11         }
12         if(num == 4){
13             num = 0;
14             puts("");
15         }
16     }
17     puts("");
18     return 0;
19 }

显示结果

 1 #include <stdio.h>
 2 #include <ctype.h>
 3 
 4 int main(){
 5     
 6     int num = 0;
 7     for(int i = 0; i < 256; ++i){
 8         if(isalpha(i)){
 9             printf("%d\t'%c'\t", i, i);
10             ++num;
11         }
12         if(num == 4){
13             num = 0;
14             puts("");
15         }
16     }
17     puts("");
18     return 0;
19 }

 1 #include <stdio.h>
 2 #include <ctype.h>
 3 
 4 int main(){
 5     
 6     for(int i = 0; i < 256; ++i){
 7         if(isdigit(i)){
 8             printf("ASCII=%d\t'%c'\n", i, i);
 9         }
10     }
11     return 0;
12 }

 

posted @ 2016-06-05 00:19  爱白菜的小昆虫  阅读(322)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3