C++ 字符串反转并连接 - 编程练习题
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char s[31], t[61];
cin >> s;
int len = strlen(s);
for (int i = 0; i < len; i++) {
t[i] = s[len - i - 1];
}
for (int i = 0; i < len; i++) {
t[i + len] = s[i];
}
t[2 * len] = '\0';
cout << t << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/nKMZ 著作权归作者所有。请勿转载和采集!