反转字符串

cout << "Please Enter a word: ";
    string word;
    cin >> word;

    char temp;
    int i,j;
    for (int j = 0, i = word.size() - 1; j < i; ++j,--i) {
        temp = word[i];
        word[i] = word[j];
        word[j] = temp;
    }
    cout << word;
0 0 投票数
文章评分
订阅评论
提醒
guest
0 评论
内联反馈
查看所有评论
京ICP备17066706号-1
0
希望看到您的想法,请发表评论。x
()
x