You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
pwjku6f2y 6eaa46e3f7
多函数集合
3 years ago
README.md Update README.md 3 years ago

README.md

Function //字符分类统计

#include<stdio.h> void Stringcount(char s[]) { int le1=0,le2=0,di=0,sp=0,ot=0; //定义大写字母、小写字母、数字、空格和其它字符个数 int i; for(i=0;s[i] != '\0';i++) { if(s[i] >='A' && s[i] <='Z') le1++; else if(s[i] >= 'a' && s[i] <= 'z') le2++; else if(s[i] >= '0' && s[i] <= '9') di++; else if(s[i]==' ') sp++; else ot++; } printf("%d %d %d %d %d",le1,le2,di,sp,ot); //输出个数 } int main() { char a[10]; gets(a); //输入字符串 Stringcount(a); //引用函数 return 0; }