程序代码:
#include <stdio.h> #define SIZE 81 int main(void) { char str_in[SIZE], str_out[SIZE], * p_in = str_in, * p_out = str_out; gets(str_in); while(*p_in) { if(*p_in == ' ' && *(p_in + 1) != ' ') { *p_out++ = *p_in++; } else if(*p_in == ' ' && *(p_in + 1) == ' ') { p_in++; continue; } else { *p_out++ = *p_in++; } } *p_out = '\0'; puts(str_out); return 0; }
[ 本帖最后由 lz1091914999 于 2011-6-5 12:29 编辑 ]
My life is brilliant