题目1055 数组逆置 九度Online Judge

来源:互联网 发布:mysql表格创建 编辑:程序博客网 时间:2024/05/16 09:10
题目描述:

输入一个字符串,长度小于等于200,然后将数组逆置输出。

输入:

测试数据有多组,每组输入一个字符串。

输出:

对于每组输入,请输出逆置后的结果。

样例输入:
hdssg
样例输出:
gssdh
#include <iostream>#include <string>using namespace std;int main(){    string str;    int i;    while (cin>>str)    {        for (i=str.length()-1;i>=0;i--)        {            cout<<str[i];        }        cout<<endl;    }    return 1;}/**************************************************************    Problem: 1055    User: Carvin    Language: C++    Result: Accepted    Time:10 ms    Memory:1520 kb****************************************************************/


0 0