#include <string>
#include <iostream>
using namespace std;
void Reverse(string &s, int index)
{
static string copy_str = string(s.length(), '\0');
if (index == s.length())
{
cout << copy_str << endl;
return;
}
copy_str[index] = s[s.length()-index-1];
Reverse(s, index+1);
}
int main(void)
{
string s = "abc";
Reverse(s, 0);
return 0;
}
#include <string>
#include <iostream>
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载