ahgdzhc @ 2023-03-07 13:40:45
#include <string.h>
int main()
{
char c[100];
gets(c);
int len=strlen(c);
for(int i=len-1;i>=0;i--)
{
printf("%c",c[i]);
}
return 0;
}
by ahgdzhc @ 2023-03-07 13:44:21
IDE上没错但是提交就是WA
by WA_sir @ 2023-03-07 13:49:23
@ahgdzhc 不能用 gets
by WA_sir @ 2023-03-07 13:51:02
@ahgdzhc 头文件少了
by ahgdzhc @ 2023-03-07 13:53:44
@WA_sir 谢大佬 已解决
by Tim0509 @ 2023-03-07 13:54:22
gets在c++里被弃用了 应该用string+getline
#include <bits/stdc++.h>//万能头文件,包含所有c++&c头文件(罢
using namespace std;
string c;//
int main()
{
getline(cin,c);//
int len=c.length();//
for(int i=len-1;i>=0;i--)
{
printf("%c",c[i]);
}
return 0;
}
by WA_sir @ 2023-03-07 18:12:24
@Tim0509 错误的.
char
数组可以用 scanf("%s",);
读入.
by Tim0509 @ 2023-03-07 20:03:31
@WA_sir
正确的
我是蒟蒻,谢谢大佬指引
by hymccc @ 2023-03-26 17:10:05
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd