5.8字符
来源:互联网 发布:linux使用crontab-e 编辑:程序博客网 时间:2024/05/16 12:49
#include <stdio.h>#include <stdlib.h>int main(){ char ch; printf("请输入一个字符ch:"); scanf("%c",&ch); if(ch>=65&&ch<=90) { printf("该字符是大写字母\n"); printf("ch=%c\n",ch); } else if(ch>=97&&ch<=122) { printf("该字符是小写字母\n"); printf("ch=%c\n",ch); } else if(ch>=48&&ch<=57) { printf("该字符是数字字符\n"); printf("ch=%c\n",ch); } else if(ch==32) { printf("该字符是空格\n"); } else { printf("该字符是其他字符\n"); } printf("%c\n",ch); return 0;}
知识点:字符的使用 ASII码的使用