```cpp #include <iostream> #include <vector> using namespace std; int main() { vector<int> nums = {1, 10, 100, 1000, 10000}; // 原始数组 vector<int> modified_nums; // 存储修改后的数组 int target_num = 4; // 目标值 for (int num : nums) { if (num == -1) { modified_nums.push_back(target_num); } else { modified_nums.push_back(num); } } // 输出修改后的数组 for (int num : modified_nums) { cout << num << " "; } return 0; } ``` [2025-04-05 11:52:06 | AI问答 | 351点数解答]