调转字符串
#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;--i,++j)
{
temp=word[i];
word[i]=word[j];
word[j]=temp;
}
cout<<word<<"\nDone\n";
return 0;
}
//据我理解for的顺序,
j=0,i=word.size()-1;
j<1;
temp=word[i];
word[i]=word[j];
word[j]=temp;
--i,++j