"); //-->
void cal_A_a_num(void) { int total_num,a_count,A_count,Num_count,space_count=0,i; char str[100]={0};//"ssssddd ddAAAD DDDD2223323 "; printf("please input string \r\n"); //total_num = scanf("%s\r\n",str);//遇到空格会结束 gets(str); printf("%s %d\r\n",str,strlen(str)); while(i< strlen(str)) { if(('a'<=str[i]) &&(str[i] <='z')) { a_count++; } else if(('A'<= str[i]) &&(str[i] <= 'Z')) { A_count++; } else if(('0' <= str[i]) &&(str[i] <= '9')) { Num_count++; } else if(str[i] == ' ') { space_count++; } i++; } printf("a number is %d,A number is %d,Num count is %d spcace count is %d",a_count,A_count,Num_count,space_count); }
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。