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 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{p...
// int main() { // char ch=0; // while(scanf("%c",&ch)==1) // { // if((ch>='A'&&ch<='Z')||(ch>='a'&&ch<='z')) // printf("%c is an alphabet.\n",ch); // else // printf("%c is not an alphabet.\n",ch); // getchar();//吸收'\n' // } // ret...
#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;} 按照我们的预想,输出一个字...
=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;}...
printf(" %c is not an alphabet letter\n" ,ch); 你可以随意选择一种方法在程序中使用。但是,后一种方法的可读性要好一些,因为你很难 记住 ASCII 码表中每个字符所对应的十进制值。 怎样判断一个字符是否是一个数字? 在 ASCII 码表中,数字字符所对应的十进制值在 48 到 57 这个范围之内,因此,你可以用...
#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("%...
The islapha() function checks whether a character is an alphabet or not. #include <ctype.h> #include <stdio.h> int main() { char c; int lowercase_vowel, uppercase_vowel; printf("Enter an alphabet: "); scanf("%c", &c); // evaluates to 1 if variable c is a lowercase vowel ...
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; ...
cellulse acetate memb celluslitis cellwallthickness cellrelay cell cleaning cell single-fluid vol celosia cristata linn celotex celp codeexcitedlinea celscells celsiu cale celss celtiberians celtic lady art celtic people celtic reverie celtic song celtic tree alphabet celtidaceae celtis biondii pamp ...