| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 395 人关注过本帖
标题:求解
取消只看楼主 加入收藏
moyurongxu
Rank: 1
来 自:广西科技大学鹿山学
等 级:新手上路
帖 子:35
专家分:6
注 册:2012-10-11
结帖率:62.5%
收藏
已结贴  问题点数:20 回复次数:3 
求解
将以下程序补充完整,实现:输入一行字符,分别统计出其中英文字母、空格、数字和其他字母的个数。
#include <stdio.h>
int main( )
{
  char c;
  int letter=0,space=0,digit=0,other=0;
  printf("input a line letter:\n");
      __________           /*读取当前字符,如不为回车符则进行统计*/
    {
     if(c>='a' && c<='z'||c>='A' && c<='Z')
      letter++;
     else if(c==' ')
       space++;
else   __________                     
       digit++;
     else
       other++;
    }
 printf(" letter=%d,space=%d,digit=%d,other=%d\n",letter,space,digit,other);
 return 0;
}
搜索更多相关主题的帖子: include 英文字母 letter 统计 
2012-12-04 15:30
moyurongxu
Rank: 1
来 自:广西科技大学鹿山学
等 级:新手上路
帖 子:35
专家分:6
注 册:2012-10-11
收藏
得分:0 
#include <stdio.h>
 int main( )
 {
   char c;
   int letter=0,space=0,digit=0,other=0;
   printf("input a line letter:\n");
      getcher()         /*读取当前字符,如不为回车符则进行统计*/
     {
      if(c>='a' && c<='z'||c>='A' && c<='Z')
       letter++;
      else if(c==' ')
        space++;
 else   if(c>=0&&c<=9)                     
        digit++;
      else
        other++;
     }
printf(" letter=%d,space=%d,digit=%d,other=%d\n",letter,space,digit,other);
return 0;
 
是否

新手请多多指教
2012-12-05 22:20
moyurongxu
Rank: 1
来 自:广西科技大学鹿山学
等 级:新手上路
帖 子:35
专家分:6
注 册:2012-10-11
收藏
得分:0 
不会如可输入一横字符

新手请多多指教
2012-12-05 22:21
moyurongxu
Rank: 1
来 自:广西科技大学鹿山学
等 级:新手上路
帖 子:35
专家分:6
注 册:2012-10-11
收藏
得分:0 
几天没上,不好意思

新手请多多指教
2012-12-12 18:04
快速回复:求解
数据加载中...
 
   



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

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