C语言程序设计(第二版)练习1-12

#include <stdio.h>

#define IN 1
#define OUT 0

main()
{
	int c,state;

	state=OUT;
	while((c = getchar()) != EOF)
	{
		if(c == '\n' || c == '\t' || c == ' ')
		{
			if(state == IN)
			printf("\n");
			state=OUT;
		}else
		{
			putchar(c);
			state=IN;
		}

	}
}
注意:当多次换行,制表符,空格连续出现的情况。

猜你喜欢

转载自blog.csdn.net/birdunderastarrysky/article/details/80961313
今日推荐