#include "stdafx.h"
#include <iostream>
#include <string>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
string str;
cout<<"Enter a word:";
cin>>str;
for (int i=str.size()-1;i>=0;--i)//不考虑空值字符
{
cout<<str[i];
}
cout<<endl;
system("pause");
return 0;
}
string类的size()获得字符串的字符数,不考虑空值字符,size-1