string reverse(string &s)
{
string::reverse_iterator it=s.rbegin();
string tem;
while(it!=s.rend())
{
tem.push_back(*it);
it++;
}
return tem;
}
int _tmain(int argc, _TCHAR* argv[])
{
string s("abcdefg");
cout<<reverse(s)<<endl;
return 0;
}
posted on 2012-05-18 16:14
qiushao 阅读(147)
评论(0) 编辑 收藏 引用