string本身没有逆转的函数,CString才有,如果能用CString就先转换到CString调用Reverse,否则就自己遍历吧
#include
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string test;
int len=0;
cout<<"Please input a string:";
cin>>test;
for (int i =test.length()-1;i>=0;i--)
{
cout<}
cout<return 0;
}
1 #include
2 using namespace std;
3
4 int main()
5 {
6 string str;
7 cin >> str;
8
9 for(string::size_type ix = str.size(); ix != 0; --ix)
10 cout << str[ix-1];
11 cout << endl;
12
13 return 0;
14 }
~
for (auto it = a.crbegin(); it != a.crend(); ++it) {
cout << *it;
}
cout << endl;