文章

145

粉丝

143

获赞

21

访问

39.7k

头像
反序输出 题解:C
P1155 清华大学上机题
发布于2024年2月5日 20:19
阅读数 341

#include <stdio.h>
#include <string.h>

void Reverse(char *s)
{
	char *p = s;
	while(*p != '\0') p++;
	p--;
	while(p >= s)
	{
		printf("%c",*p);
		p--;
	}
}

int main()
{
	char s[5];
	while(scanf("%s",s) != EOF)
	{
		Reverse(s);
		printf("\n");
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发