思路:感觉就是模拟题。。。。。直接给代码
代码如下:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char a[1100];
int i;
int t;
char b[1100];
int left,right;
int x;
int y;
scanf("%d%*c",&t); //这里注意下,要一个抑制符,吃掉输入后的换行符
while(t--)
{
for(i=0;i<1100;i++)
a[i]='\0';
gets(a);
left=right=0;
y=0;
for(i=0;i<=strlen(a);i++)
{
if(a[i]==' '||a[i]=='\0')
{
right=i;
for(x=right-1;x>=left;x--)
{
b[y]=a[x];
y++;
}
b[y]=' ';
y++;
left=i+1;
}
}
for(i=0;i<strlen(a);i++)
printf("%c",b[i]);
printf("\n");
}
return 0;
}