原创
《The C programming language》lession 1
第一章主要是介绍C语言的基本知识,
1、标志Flags的使用
Flags用来标记状态,这是例1-11的程序代码
#include
int main()
{
int c, isspace;
isspace = 0;
while((c = getchar()) != EOF)
{
if(c == ' ' || c == '\t' || c == '\n')
{
if(isspace == 0)
{
isspace = 1;
putchar('\n');
}
}
else
{
isspace = 0;
putchar(c);
}
}
return 0;
}
用户403664 2015-1-22 17:15