第2个回答 2012-03-25
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
char s1[1024],s2[1024];
int nPos,nLen;
printf("Input s1 string:\n");
gets(s1);
for(nPos=0,nLen=0; s1[nPos]!='\0';nPos++)
{
s2[nLen++] = s1[nPos];
if(nPos &&((nPos+1)%3==0))s2[nLen++]=' ';
}
s2[nLen++] = '\0';
printf("s2 is:\n%s\n",s2);
system("PAUSE");
return 0;
}本回答被提问者采纳