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 AL8624 @ 2023-08-01 16:28:14
str[len - 1 - i] = str[i]; --> str[len - 1 - i] = temp;
by AL8624 @ 2023-08-01 16:28:33
还有你的include前面没打#
by AL8624 @ 2023-08-01 16:28:51
下次自己认真检查完在发行吗
by gzh0313 @ 2023-08-01 16:32:03
@aeiklst 啊?我看有#啊
by _Glassy_Sky_ @ 2023-08-01 16:34:31
@gzh0313 可能是他自己复制代码的时候没复制到
by Morningstar01 @ 2023-08-01 17:26:10
@aeiklst 不好意思,第二个include复制的时候有点问题,但是代码在vs是可以正常运行的,却在提交答案的时候显示WA,想问一下这是为什么
by AL8624 @ 2023-08-01 17:57:10
这个怕是编译都不行
by AL8624 @ 2023-08-01 17:58:16
#include<stdio.h>
#include<string.h>
int main()
{
char str[100],temp;
gets(str);//gets_s(str,size);
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] = temp;
}
puts(str);
}
by Morningstar01 @ 2023-08-01 18:14:04
@aeiklst
emmmm,你不知道可以不回答的,硬说不会尬吗? 我都说了那个#是没复制到
by AL8624 @ 2023-08-01 18:50:03
emm我说的是你的gets_s会CE