int main(){ char p;scanf("%c",&p);if(p>='a' && p<='z' || p>='a' && p<='z')printf("英文字符\n");else if(p>='0' && p<='9')printf("数字字符\n");else printf("其他字符\n");return 0;}
int main(){ char p;scanf("%c",&p);if(p>='a' && p<='z' || p>='a' && p<='z')printf("英文字符\n");else if(p>='0' && p<='9')printf("数字字符\n");else printf("其他字符\n");return 0;}
#include<stdio.h>int main(){ char a; while ((a = getchar()) != EOF) { if ((a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z')) printf("%c is an alphabet.\n", a); else printf("%c is not an alphabet.\n", a); } return 0;} 按照我们的预想,输出一个字...
char•ac•ter (ˈkær ɪk tər) n. 1.the aggregate of features and traits that form the individual nature of a person or thing. 2.one such feature or trait; characteristic. 3.moral or ethical quality:a woman of strong character. ...
{char input;while(scanf("%c",&input)!=EOF){if(input=='\n'){continue;}if((input>=65&&input<=90)||(input>=97&&input<=122))//字符底层用ascii码存储,大写字母ascii码范围是65-90,小写字母是97-122{printf("%c is an alphabet.\n",input);}else{printf("%c is not an alphabet.\n",...
Enter an alphabet: i i is a vowel. 输出2: Enter an alphabet: G G is a consonant. 也可以用条件运算符解决 /* C program to check whether a character is vowel or consonant using conditional operator */ #include int main(){ char c; ...
输出:A is an alphabet. 6 is not an alphabet. 以下代码均经过牛客测试,均正确,请放心测试 解题思路: 这里的我提供三种解法: 代码: // #include <stdio.h> //解法一: // int main() { // char ch=0; // while(scanf("%c",&ch)==1) ...
#include <stdio.h> #include <ctype.h> int main() { // defining the type of variable char a,b; // assigning the value of variable a = 'A'; b = '1'; // condition to check the character if (isalpha(a) != 0) { printf("%c is an alphabet\n", a); } else { printf("%...
=EOF){//来进行多组输入!if((n>='a'&&n<='z')||(n>='A'&&n<='Z'))//输入字符n,来判断是否在A-Z,a-z这两个//范围之内,在的话,就是字母,否则不是!{printf("%c is an alphabet.\n",n);getchar();//重点}else{printf("%c is not an alphabet.\n",n);getchar();}}return0;}...