#include <stdio.h>
#include <string.h>
int main()
{
char str[40],*p;
int a=0,b=0,c=0,d=0,e=0;
gets(str);
p=str;
while(*p!='\0')
{
if(*p++>='A'&&*p++<='Z')
a++;
if(*p++>='a'&&*p++<='z')
b++;
if(*p++>='0'&&*p++<='9')
c++;
if(*p++==' ')
d++;
else
e++;
}
printf("a=%5d\nb=%5d\nc=%5d\nd=%5d\ne=%5d\n",a,b,c,d,e);
return 0;
}
运行时不能得到正确结果,我想知道是什么原因