#include<stdio.h>
#include<string.h>
void search(int *p1, int *p2, int *p3, int *p4, char b[100])
{
int i, k;
k = strlen(b);
for(i = 0; i < k; i++)
{
if((b[i] >= 'A'&&b[i] <= 'Z') || (b[i] >= 'a'&&b[i] <= 'z'))
*p1 = *p1 + 1;
else if(b[i] >= '0'&&b[i] <= '9')
*p2 = *p2 + 1;
else if(b[i] == ' ')
*p3 = *p3 + 1;
else *p4 = *p4 + 1;
}
}
int main(void)
{
int w = 0, n = 0, s = 0, o = 0;
char a[100];
gets(a);
search(&w, &n, &s, &o, a);
printf("%d %d %d %d\n", w, n, s, o);
return 0;
}
int search(int *p1,int *p2,int *p3,int *p4,char b[100])
30 7 6 12
请按任意键继续. . .
|