解题思路:
注意事项:
参考代码:
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <stdio.h> using namespace std; void rev(int cur, const int n, string & str) { if (cur >= n / 2) return; char temp = str[cur]; str[cur] = str[n - cur - 1]; str[n - cur - 1] = temp; cout << str << endl; rev(cur + 1, n, str); } int main(int argc, char** argv) { int n = 0; string s; cin >> n >> s; rev(0, n, s); cout << endl << s; return 0; }
0.0分
0 人评分
C语言训练-计算t=1+1/2+1/3+...+1/n (C语言代码)浏览:869 |
十->二进制转换 (C语言代码)浏览:1291 |
打水问题 (C语言代码)浏览:1072 |
A+B for Input-Output Practice (V) (C语言代码)浏览:625 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:350 |
Hello, world! (C++代码)浏览:1745 |
C语言训练-自由落体问题 (C语言代码)浏览:620 |
文科生的悲哀 (C语言代码)浏览:1401 |
蛇行矩阵 (C语言代码)浏览:507 |
小O的数字 (C++代码)浏览:763 |