题解 | #字符串反转#

字符串反转

http://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04

C语言向C++的过渡写法不建议这么写。

#include<iostream>
#include<string.h>
using namespace std;

int main()
{
    char instr[1000+1];
    cin >> instr;
    int i = strlen(instr)-1;
    
    for( ; i>=0; i--)
    {
        cout << instr[i];
    }
    
    cout << endl; 
    return 0;
}
全部评论

相关推荐

大象1113:RM竞赛实力这么强,转正都转不了,这公司得多强?要求的多高?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务