题解 | 复制部分字符串
#include <iostream> using namespace std; int main() { char str[30] = { 0 }; cin.getline(str, sizeof(str)); int m; cin >> m; // write your code here...... char str1[30]; for (int i = m - 1; i < sizeof(str); i++){ str1[i - m + 1] = str[i]; if (*(str + i) == '\0'){ break; } } for (int i = 0; i < sizeof(str1); i++){ if (*(str1 + i) == '\0'){ break; } cout << *(str1 + i); } return 0; }