| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 524 人关注过本帖
标题:报错,这个真把我搞懵了
取消只看楼主 加入收藏
张学平
Rank: 2
等 级:论坛游民
帖 子:26
专家分:13
注 册:2013-11-20
结帖率:75%
收藏
 问题点数:0 回复次数:1 
报错,这个真把我搞懵了
程序代码:
#include "stdio.h"
#include <string.h>
#define p printf
int main(void)
{int l,n,s,o,sum,i;l=n=s=o=sum=0;

 char c[200];//说c未声明,,为什么啊?
 printf("Please input the string\n");

 gets(c);//报错,,
 for(i=0;i<strlen(c);i++)
  {sum++;
      if((c[i]>=48)&&(c[i]<=57))n++;
       else if(c[i]==32)s++;
            else if(((c[i]>=65)&&(c[i]<=90))||((c[i]>=97)&&(c[i]<=122)))l++;//这些if语句有问题吗?
                 else o++;
  }

 p("The summary is %d\n",sum);

 p("The number of letters is %d\n",l);

 p("The number of numbers is %d\n",n);

 p("The number of spacebars is %d\n",s);

 p("Other chars:%d\n",o);
}
2013-12-03 08:22
张学平
Rank: 2
等 级:论坛游民
帖 子:26
专家分:13
注 册:2013-11-20
收藏
得分:0 
VC6.0,TC2.0都报错
2013-12-09 09:28
快速回复:报错,这个真把我搞懵了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011785 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved