运行结果为什么不对呀?

[复制链接]
查看11 | 回复0 | 2007-10-18 13:16:45 | 显示全部楼层 |阅读模式
源程序如下:#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; }
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行