哪位大哥有空可不可以帮我把这段程序的解释写一下?谢谢,100分相送感谢!!
#include <stdio.h>
#define NONBLANK 'a'
main()
{
int c,lastc;
lastc=NONBLANK;
while ((c=getchar())!=EOF){
if(c!=' ')
putchar(c);
else if (lastc!=' ')
putchar(c);
lastc=c;
}
}
#include <stdio.h>
#define NONBLANK 'a'
main()
{
int c,lastc;
lastc=NONBLANK;
while ((c=getchar())!=EOF){
if(c!=' ')
putchar(c);
else if (lastc!=' ')
putchar(c);
lastc=c;
}
}
循环读于字符,将字符付给c,直到c=eof结束循环
循环里面,如果c<>' ',putchar(c),如果c=' ' and 上次的c<>' ',putchar(c);
lastc=c;纪录最新得到的c