标签:
1-9 编写一个将输入复制到输出的程序,并将其中连续的多个空格用一个空格代替.
1 #include<stdio.h> 2 int main() 3 { 4 int c, lastc; 5 lastc = 0; 6 while ((c = getchar()) != EOF) 7 { 8 if (c != ‘ ‘) 9 { 10 putchar(c); 11 } 12 else if (lastc != ‘ ‘) 13 { 14 putchar(c); 15 } 16 lastc = c; 17 } 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/futa/p/5244767.html