parent
7d77937185
commit
7b8afcfd32
@ -0,0 +1,27 @@
|
||||
#include<stdio.h>
|
||||
void tongji(char str[]);
|
||||
int main()
|
||||
{
|
||||
char str[1000]={'\0'};
|
||||
gets(str);
|
||||
tongji(str);
|
||||
return 0;
|
||||
}
|
||||
void tongji(char str[])
|
||||
{
|
||||
int xxzm=0,dxzm=0,sz=0,kg=0,qt=0;
|
||||
for(int i=0;str[i]!='\0';i++)
|
||||
{
|
||||
if('a'<=str[i]&&str[i]<='z')
|
||||
xxzm++;
|
||||
else if('A'<=str[i]&&str[i]<='Z')
|
||||
dxzm++;
|
||||
else if('0'<=str[i]&&str[i]<='9')
|
||||
sz++;
|
||||
else if(str[i]==' ')
|
||||
kg++;
|
||||
else
|
||||
qt++;
|
||||
}
|
||||
printf("%d %d %d %d %d \n",dxzm,xxzm,sz,kg,qt);
|
||||
}
|
Loading…
Reference in new issue