源程序如下:#include main() { int big=0,small=0,space=0,number=0,other=0; char *p; char s[200]; printf("Please enter a string:"); gets(s); p=s; while(*p!='\0') {if(*p>='a'&&*p='A'&&*p='0'&&*p main() { int big=0,small=0,space=0,number=0,other=0; char *p; char s[200]; printf("Please enter a string:"); gets(s); p=s; //这里p的值是地址.而你用=是付值运算.改成p=&swhile(*p!='\0') {if(*p>='a'&&*p='A'&&*p=0&&*p int main() {int big=0,small=0,space=0,number=0,other=0;char* p;char s[200];printf("Please enter a string:"); gets(s); for (p=s;(*p)!='\0';p++) { if ((*p)>='A'&&(*p)='a'&&(*p)='0'&&(*p)<='9') number++; else if ((*p)==' ') space++; else other++;} printf("\tbig=%d\n\tsmall=%d\n\tspace=%d\n\tnumber=%d\n\tother=%d\n",big,small,space,number,other); return 0; } |