#include<iostream>
#include<cstring>
int main()
{
using namespace std;
cout << "Enter a word: ";
string word;
cin >> word;
char temp;
int i,j;
for(j = 0,i = word.size() - 1;j < i;--1,++j){
temp = word[i];
word[i] = word[j];
word[j] = temp;
}
cout << word << "\nDone\n";
return 0;
}
Sample 5.9: forstr2.cpp
最新推荐文章于 2022-02-06 20:57:03 发布