#includeint main(){ printf("请输入10个字符\n"); char a[10]; for(int i=0;i<10;i++) { scanf("%c",&a); } int x=0,y=0,z=0;//x表示大写字母,y表示小写字母,表示数字字符; for(int j=0;j<10;j++) { if(a[j]&]gt;=65 && a[j]&]lt;=90) x++; if(a[j]&]gt;=97...
题目 输入一个字符串,编一个函数统计其中大写字母的个数、小写字母、 数字,要求用指针作为形参,用数组名作实参。 相关知识点: 试题来源: 解析#include int Aletter=0,aletter=0,num=0; void count(char *p) { for(;*p!='\0';p++) if(*p>='A' && *p<='Z') Aletter++;...
}//统计char数组中小写字母publicstaticchar[] loweredCharAmout(char[] arrChar1){//定义一个数组接收小写字母,因为数组必须有长度所以我们先预定长度为原数组的长度char[] arrLower1 =newchar[arrChar1.length];intj = 0;for(inti = 0 ; i < arrChar1.length ; i++){if(arrChar1[i] >= 'a' &&...
cout<<"其中的数字个数是: "<<n1<<endl<<"其中的小写字母个数是:"<<n2<<endl<<"其中的 大写字母个数是:"<<n3<<endl<<"其他字符数的个数是:"<<n4<<endl;return 0;} 运行效果:
1.键盘录入5个字符串,组成一个数组 2.统计录入的字符串数组中的大写字母,小写字母,数字分别有多少个. `public class Test03 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入字符串中的大写字母,小写字母,数字都可以");...
编程序从键盘上输入一个字符串(长度小于或等于80),分别统计其中的字母、数字和其他字符的数目。本题要求用指向数组首地址的指针变量来处理字符率中的字符。 相关知识点: 试题来源: 解析[参考答案]main() { char s[81],*p=s; int c1,c2,c3;
int main(){ char str[100];int i=0;int num=0,ch=0,blank=0,other=0;gets(str);while(str[i]!='\0'){ if((str[i]>='A' && str[i]<='Z') || (str[i]>='a' && str[i]<='z'))ch++;//字母 else if(str[i]>='0' && str[i]<='9')num++;//数字 else if...
函数——统计数组中字母字符的个数赋值给char_num;数字字符的个数赋值给data_num;元素的个数(不包括'\0'和回车),赋值给total_num;,...
int Numb_count = 0;//数字个数 int ABC_count = 0;//大写字母个数 int abc_count = 0;//小写字母个数 scanf("%s", str);//连续输入字符到字符数组 while (str[i] != '\0'){ if ((str[i] >= '0') && (str[i] <= '9'))//判断是否是数字 { Numb_count++;} else if...
字符个数统计 由键盘输入任意一串字符串,将其存入一个字符数组,统计其中的大写字母、小写字母、数字以及 输入: 任意一串字符串 输出: 大写字母、小写字母、数字以及其他字符的个数。 输入样例: abcdefg123456ABCDEFG 输出样例: 7 7 6 #include <stdio.h> #define