| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1798 人关注过本帖
标题:ndigit[10];对于这个用法不了解
只看楼主 加入收藏
天衣boy
Rank: 1
来 自:中国河南
等 级:新手上路
帖 子:99
专家分:0
注 册:2016-10-20
结帖率:69.23%
收藏
 问题点数:0 回复次数:0 
ndigit[10];对于这个用法不了解
#include <stdio.h>
/* count digits, white space, others */
main()
{
int c, i, nwhite, nother;
int ndigit[10];
nwhite = nother = 0;
for (i = 0; i < 10; ++i)
ndigit[i] = 0;
while ((c = getchar()) != EOF)
if (c >= '0' && c <= '9')
++ndigit[c-'0'];
else if (c == ' ' || c == '\n' || c == '\t')
++nwhite;
else
++nother;
printf("digits =");
for (i = 0; i < 10; ++i)
printf(" %d", ndigit[i]);
printf(", white space = %d, other = %d\n",
nwhite, nother);
}
搜索更多相关主题的帖子: include white others count 
2016-10-24 20:55
快速回复:ndigit[10];对于这个用法不了解
数据加载中...
 
   



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

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