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 /* inside a word */
#define OUT 0 /* outside a word */ /* print input one word per line */
main()
{
int c, state = OUT;
while((c = getchar()) != EOF)
{
if(c == ' ' || c == '\n' || c == '\t')
{
if(state == IN)
{
putchar('\n'); /* finish the word */
state = OUT;
}
else if(state == OUT)
{
state = IN; /* beginning of word */
putchar(c);
}
else /* inside a word */
{
putchar(c);
}
}
}
}
C - The C Answer (2nd Edition) - Exercise 1-12的更多相关文章
- 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-8
		/* Write a program to count blanks, tabs, and newlines. */ #include <stdio.h> /* count blanks, ... 
- 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-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 ... 
随机推荐
- python_函数、局部变量与全局变量
			#函数优点:代码重用.保持一致性.可扩展性import time def logger(): """时间年-月-日 分""" time_fo ... 
- ajax的两种使用方式
			一.Ajax概述 1.什么是同步,什么是异步 同步现象:客户端发送请求到服务器端,当服务器返回响应之前,客户端都处于等待 卡死状态 异步现象:客户端发送请求到服务器端,无论服务器是否返回响应,客户端都 ... 
- 2.WHERE中使用=,>,>=,<,<=,<>,!=比较符号
			//查询工资大于等于2000的人 select * from person salary >= 2000; //查询名字等于scott的人 select * from per ... 
- Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别?
			Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别? 1.什么是Set?(what) Set是Collection容器的一个子接口,它不允许出现 ... 
- 洛谷 1052 dp 状态压缩
			洛谷1052 dp 状态压缩 传送门 (https://www.luogu.org/problem/show?pid=1052#sub) 做完这道题之后,感觉涨了好多见识,以前做的好多状压题目都是将一 ... 
- xcode5.1生成framework,支持arm64报错
			错误例如以下: ld: Assertion failed: (_machoSection != 0), function machoSection, file /SourceCache/ld64/ld ... 
- Swift基础--定位
			// // ViewController.swift // JieCoreLocation // // Created by jiezhang on 14-10-4. // Copyright (c) ... 
- 数组溢界地址的正确使用: 即 int  a[6] 中的  a[-1] 和 a[6] 正确使用
			正如大家所知道的那样: 数组 int a[6] , 编译器阅读到这句数组定义,会为分配6个int 类型的地址:a[0] a[1] a[2] a[3] a[4] a[5].我们 能够正 ... 
- JAVA设计模式之【职责链模式】
			职责链模式 专门处理请求链式传递的模式 角色 Handler抽象处理者 ConcreteHandler具体处理者 在职责链模式中,很多对象由每一个对象对其下家的引用而连接成一条链,请求在这条链上传递, ... 
- MHA+ProxySQL 读写分离高可用
			文档结构如下: 1.ProxySQL说明 ProxySQL是mysql的一款中间件的产品,是灵活的mysql代理层,可以实现读写分离,支持query路由器的功能,支持动态指定sql进行缓存,支持动态加 ... 
