C++用reverse逆序输出一个字符串

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    string a;
    getline(cin,a);
    reverse(a.begin(),a.end());
    cout<<a;
    return 0;
}

 

posted @ 2019-06-19 22:19  寂寞致幻  阅读(6019)  评论(0编辑  收藏  举报