运行 ❯
获取你的
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { // Create a vector called numbers that will store integers vector<int> numbers = {1, 7, 3, 5, 9, 2}; // Create a vector called copiedNumbers that should store 6 integers vector<int> copiedNumbers(6); // Copy elements from numbers to copiedNumbers copy(numbers.begin(), numbers.end(), copiedNumbers.begin()); // Print elements of copiedNumbers for (int num : copiedNumbers) { cout << num << "\n"; } return 0; }
1
7
3
5
9
2