1 #include<iostream>
 2 #include<string>
 3 using namespace std;
 4 string reverse(string &str){
 5     if(str.length()>1){
 6         string sub=str.substr(1,str.length()-2);
 7         return str.substr(str.length()-1,1)+reverse(sub)+str.substr(0,1);
 8     }
 9     else return str;
10 }
11 int main(){
12     string str;
13     cin>>str;
14     cout<<"倒序反转后为:" <<reverse(str)<<endl;
15     return 0;
16 }

参考 http://www.cnblogs.com/aijianiula/archive/2012/05/14/2500763.html

相关文章:

  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2021-11-27
相关资源
相似解决方案