C - The C Answer (2nd Edition) - Exercise 1-8
/*
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的更多相关文章
- C - The C Answer (2nd Edition) - Exercise 1-7
/* Write a program to print the value of EOF. */ #include <stdio.h> main() { printf("EOF ...
- 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 ...
- C - The C Answer (2nd Edition) - Exercise 1-1
/* Run the "hello, world" program on your system. Experiment with leaving out parts of the ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- C - The C Answer (2nd Edition) - Exercise 1-4
/* Write a program to print the corresponding Celsius to Fahrenheit table. */ #include <stdio.h&g ...
- 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 ...
随机推荐
- OpenFlow_tutorial_3_Learn_Development_Tools
一.Several Utilities OpenFlow Tutorial VM 中预装了一些OpenFlow特性的工具和一般通用网络的工具. 1.Openflow Controller:处于Open ...
- uiviewcontroller顶级布局控制
@available(iOS 7.0, *) open var edgesForExtendedLayout: UIRectEdge // Defaults to UIRectEdgeAll @ava ...
- python连接mysql的操作
一,安装mysql 如果是windows 用户,mysql 的安装非常简单,直接下载安装文件,双击安装文件一步一步进行操作即可. Linux 下的安装可能会更加简单,除了下载安装包进行安装外,一般的l ...
- 前端入门22-讲讲模块化 包括webstrom建立简单ES6
https://www.cnblogs.com/dasusu/p/10105433.html
- 正则表达式,匹配查找函数(preg_match_all)flags参数对比
格式: int preg_match_all ( string pattern, string subject, array matches [, int flags] ) 参数 flags 选项有以 ...
- 利用jquery制作滚动到指定位置触发动画
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>利用 ...
- 路径工具类NSPathUtilities
路径工具类NSPathUtilities.h 路径类NSPathUtilities.h包含了 NSString的函数和分类扩展,他允许你操作路径名.应该竟可能的使用这些函数,以便使程序更独立于文件系统 ...
- javaScript中计算字符串MD5
进行HTTP网络通信的时候,调用API向服务器请求数据,有时为了防止API调用过程中被黑客恶意篡改,所请求参数需要进行MD5算法计算,得到摘要签名.服务端会根据请求参数,对签名进行验证,签名不合法的请 ...
- 样例GeoQuiz应用开发 第1章
1. Activity是Android SDK的Activity类的一个具体实例,负责管理用户和信息屏的交互.应用的功能是通过编写一个Activity子类来实现的.简单的可能只有一个子类,复杂的应用则 ...
- SpringBoot 全局处理以及注入请求参数
后端接口,经常会用token获取对应的账号信息.于是考虑将这个步骤封装起来. 之前项目使用ThreadLocal去做这样的事情,但昨天看SpringBoot的官方文档,发现借助框架的功能也可以做这样的 ...