编写一个程序统计各个数字、空白符(包括空格符、制表符及换行符)以及其它字符出现的次数
来源:互联网 发布:js获取flv的帧图片 编辑:程序博客网 时间:2024/05/21 00:15
#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=%\n",
nwhite, nother);
}
/*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=%\n",
nwhite, nother);
}
阅读全文
0 0
- 编写一个程序统计各个数字、空白符(包括空格符、制表符及换行符)以及其它字符出现的次数
- 【C语言】编写一个程序统计输入字符串中: 各个数字、空白字符、以及其他所有字符出现的次数。
- C语言:编写一个程序统计输入字符串中,各个数字、空白字符、以及其他所有字符出现的次数。
- 编写一个程序统计输入字符串中: 各个数字、空白字符、以及其他所有字符出现的次数
- 4.统计各个数字,空白符,以及其他字符出现的次数
- 统计各个数字、空白符、及所有其他字符出现的次数
- 统计输入字符串中: 各个数字、空白字符、以及其他所有字符出现的次数
- 统计字符串中:各个数字、空白字符、以及其他所有字符出现的次数
- K&R《C程序设计语言》p15:统计各个数字、空白符及其他字符出现的次数
- 统计输入字符中的空白符、换行符、制表符
- 编写一个统计空格、制表符和换行符个数的程序
- 编写一个统计空格,制表符与换行符个数的程序。
- [C] 编写一个统计空格、制表符与换行符个数的程序1-8
- 练习 1- 8 编写一个统计空格,制表符与换行符个数的程序
- 练习1-8 编写一个统计空格、制表符与换行符个数的程序
- C语言程序设计习题 1-8 编写一个统计空格,制表符与换行符个数的程序
- python统计一个文档中 各个字符出现的次数
- 编写一个统计空格制表符与换行符个数的函数
- 简单神经网络实现 03
- 【Java面试题】数据库连接池Java代码实现
- HDU4465-数学期望
- mysql分区分表
- GreenDao详解(二)之在项目中配置GreenDao
- 编写一个程序统计各个数字、空白符(包括空格符、制表符及换行符)以及其它字符出现的次数
- 危桥僵尸解决方案和人性
- Android中的Shape,Selector文件
- 卷积神经网络(CNN)和Tensorflow初探——MNIST
- Vim折叠设置
- http://geek.csdn.net/news/detail/240577
- Android学习-ViewPager实现导航
- 51nod 1287加农炮【线段树*好题】
- 强大的矩阵奇异值分解(SVD)及其应用