- UID
- 46356
注册时间2008-2-20
阅读权限30
最后登录1970-1-1
龙战于野
TA的每日心情 | 开心 2022-4-1 09:59 |
---|
签到天数: 76 天 [LV.6]常住居民II
|
楼主 |
发表于 2010-12-23 15:20:25
|
显示全部楼层
第七课关于ASCII码查找?
- #include "stdio.h"
- show()
- {
- unsigned char i;
- printf(" ASCII Table by:TheEnd! \n\n");
- printf(" 01234567 - 89ABCDEF\n");
- for(i = 0; i < 255; i++)
- {
- if(!(i%16))
- {
- if(i)
- {
- printf("\n");
- }
- printf(" %02XH: ",i);
- }
- if(!(i%8) && i%16)
- {
- printf(" - ");
- }
- if(i == 7 || i == 8 || i == 9 || i == 10 || i == 13 || i == 26)
- {
- printf(" ");
- }
- else
- {
- printf("%c",i);
- }
- }
- printf("%c",0xff);
- printf("\n\n");
- }
- search()
- {
- unsigned char c;
- do
- {
- clrscr();
- show();
- printf("Please input a decimal num.(0~255):");
- scanf("%d",&c);
- getchar();
- printf("c = %d, Hex = %0XH, ASCII = %c\n",c,c,c);
- printf("Search again?(Y' or 'N')");
- scanf("%c",&c);
- getchar();
- }while(c == 'y' || c == 'Y');
- }
- main()
- {
- search();
- }
复制代码 |
|