tcpl 1-9
作者:互联网
#习题1-9
##将输入中的连续多个空格替换为一个并输出
```
#include <stdio.h>
/* Run this program on itself (this file) and the following string " "
* will be only one blank long.
*/
main ()
{
int c;
while ((c = getchar()) != EOF) {
if (c == ' ') {
putchar(' ');
while ((c = getchar()) != EOF && c == ' ')
;
}
if (c != EOF)
putchar(c);
}
}
```
标签:putchar,EOF,##,tcpl,while,习题,getchar 来源: https://www.cnblogs.com/impw/p/14015370.html