字符分类统计

master
pwjku6f2y 3 years ago
parent e79d93a701
commit 7ae74eba51

@ -0,0 +1,27 @@
#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("<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD>%d Сд<D0A1><D0B4>ĸ<EFBFBD><C4B8>%d <20><><EFBFBD>֣<EFBFBD>%d <20>ո<EFBFBD>%d <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>%d",le1,le2,di,sp,ot);
}
int main()
{
char a[10];
gets(a);
Stringcount(a);
return 0;
}
Loading…
Cancel
Save