/*
Write a program to count blanks, tabs, and newlines.
*/ #include <stdio.h> /* count blanks, tabs, and newlines */
main()
{
int c, nb, nt, nl; nb = 0; /* number of blanks */
nt = 0; /* number of tabs */
nl = 0; /* number of newlines */
while((c = getchar()) != EOF)
{
if(c == ' ')
{
++nb;
}
if(c == '\t')
{
++nt;
}
if(c == '\n')
{
++nl;
}
}
printf("%d %d %d\n", nb, nt, nl);
}

C - The C Answer (2nd Edition) - Exercise 1-8的更多相关文章

  1. C - The C Answer (2nd Edition) - Exercise 1-7

    /* Write a program to print the value of EOF. */ #include <stdio.h> main() { printf("EOF ...

  2. C - The C Answer (2nd Edition) - Exercise 1-2

    /* Experiment to find out what happens when printf's argument string contains \c, where c is some ch ...

  3. C - The C Answer (2nd Edition) - Exercise 1-1

    /* Run the "hello, world" program on your system. Experiment with leaving out parts of the ...

  4. C - The C Answer (2nd Edition) - Exercise 1-16

    /* Revise the main routine of the longest-line program so it will correctly print the length of arbi ...

  5. C - The C Answer (2nd Edition) - Exercise 1-5

    /* Modify the temperature conversion program to print the table in reverse order, that is, from 300 ...

  6. C - The C Answer (2nd Edition) - Exercise 1-15

    /* Rewrite the temperature conversion program of Section 1.2 to use a function for conversion. */ #i ...

  7. C - The C Answer (2nd Edition) - Exercise 1-12

    /* Write a program that prints its input one word per line. */ #include <stdio.h> #define IN 1 ...

  8. C - The C Answer (2nd Edition) - Exercise 1-4

    /* Write a program to print the corresponding Celsius to Fahrenheit table. */ #include <stdio.h&g ...

  9. C - The C Answer (2nd Edition) - Exercise 1-6

    /* Verify that the expression getchar() != EOF is 0 or 1. */ #include <stdio.h> main() { int c ...

随机推荐

  1. getHiddenProp() 浏览器状态切换改变

    <script> function getHiddenProp() { var prefixes = ['webkit', 'moz', 'ms', 'o']; // if 'hidden ...

  2. React初步学习-利用React构建个人博客

    React初步学习-利用React构建个人博客 用React和Webpack写了一个很简单的个人博客,主要是想要熟悉一下react中各种基本基本属性及方法的使用.在构建过程中碰到不少问题,通过阅读官方 ...

  3. python爬取网页图片

    # html:网页地址 def getImg2(html): soup = BeautifulSoup(html, 'html.parser') href_regex = re.compile(r'^ ...

  4. [Python3网络爬虫开发实战] 1.8.2-Scrapy的安装

    Scrapy是一个十分强大的爬虫框架,依赖的库比较多,至少需要依赖的库有Twisted 14.0.lxml 3.4和pyOpenSSL 0.14.在不同的平台环境下,它所依赖的库也各不相同,所以在安装 ...

  5. linux中PHP安装扩展包(mongodb为例)

    相对于windows中的PHP扩展,只需要在下载相应的dll资源,并且添加配置在php.ini之后即可. 但是在linux安装扩展时,需要进行编译安装. 这里以lnmp一键安装包为例(php.ini位 ...

  6. Nginx(alias 和 root的区别)

    Nginx(alias 和 root的区别)1.alias 和 root 的区别: location /request_path/image { root /local_path/image/; } ...

  7. PHP:现有图片验证码类

    文章来源:http://www.cnblogs.com/hello-tl/p/7593022.html <?php class TL_Captcha_img{ private $image; / ...

  8. list & dictionary

    list不能直接进行对应,dictionary可以 list用[],dictionary用{}

  9. windows事件查看器

    如果一个软件发生异常,软件本身没有提示异常信息, 需要从事件查看器中查看产生的错误事件 运行输入eventvwr或者win + X

  10. HttpModule用户的验证

    HttpModule是向实现类提供模块初始化和处置事件.当一个HTTP请求到达HttpModule时,整个ASP.NET Framework系统还并没有对这个HTTP请求做任何处理,也就是说此时对于H ...