实验5-2:判断字符类别(多分支结构) 编写一个程序,其功能为:从键盘输入一个字符ch,判别该字符的类别,并输出向相应信息。 It's a uppercase letter. 或 It's a lowercase letter. 或 It's a numeric character. 或 It's a other character.
s
It's a lowercase letter. | 1 |
#include<stdio.h>
int main()
{char ch;ch = getchar();if(ch>='A' && ch<='Z'){printf("It's a uppercase letter.");}else if(ch>='a' && ch<='z'){printf("It's a lowercase letter.");}else if(ch>='0' && ch<='9'){printf("It's a numeric character.");}else{printf("It's a other character.");}return 0;
}
下载源文件 得分10.00 最后一次提交时间:2023-04-01 23:48:36 共有测试数据:2 平均占用内存:1.211K 平均CPU时间:0.00278S 平均墙钟时间:0.00278S
详细 |