Morningstar01 @ 2023-08-01 16:27:16
#include<stdio.h>
include<string.h>
int main()
{
char str[100],temp;
gets_s(str);
int len,i;
len= strlen(str);
for (i = 0; i < len/2; i++)
{
temp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = str[i];
}
puts(str);
}
这个为什么不行啊!大佬救救
by Morningstar01 @ 2023-08-01 20:09:16
@aeiklst 不好意思,有点激动了,gets在vs报错我改的gets_s,但是答案里改成gets也是WA
by AL8624 @ 2023-08-01 20:33:03
应该是gets和puts的锅,目前原因不清楚,但gets和puts在c++之后的版本逐渐弃用,我全改成cin和cout就过了