View Code of Problem 114

#include "stdio.h"
#include "math.h"
#include "string.h"

void main()
{
	int i,j,k;
	char s[100];
	char a[100];
	int len;
	gets(s);
	for(i=0;s[i]!='\0';)
	{
		for(k=0;s[i]!=' '&&s[i]!='\0';k++)				//防止i++跳过空格或者'\0'
		{
			a[k]=s[i];i++;
		}
		a[k]='\0';
		len=strlen(a);
		for(j=len-1;j>=0;j--)
			printf("%c",a[j]);
		strcpy(a,"");
		if(s[i]==' ')
		{
			printf("%c",s[i]);i++;
		}
	}
}

Double click to view unformatted code.


Back to problem 114