枯叶凋零


私信TA

用户名:15102911975

访问量:4388

签 名:

等  级
排  名 5839
经  验 1427
参赛次数 1
文章发表 9
年  龄 0
在职情况 学生
学  校 陕西科技大学
专  业

  自我简介:

解题思路: 该题主要是考虑到要算上空格的个数,才是字符串的总长度。

注意事项:不能使用scanf()输入,而是要改为gets()的字符串输入格式,然后使用strlen()函数,求其字符串长度。

参考代码:

#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

const int manx=100+5;

char s[manx];

int main()

{

gets(s);

int n=strlen(s);

for(int i=n-1;i>=0;i--)

{

printf("%c",s[i]);

}

return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区