将含有整型元素的vector对象拷贝给一个整型数组
//3.42
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> vec = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int arr[10] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
for (auto i : arr)
cout << i << " "; //输出原始整型数组arr的元素内容
cout << endl;
for (int i = 0; i != vec.size(); ++i)
arr[i] = vec[i]; //vector对象拷贝给整型数组
for (auto i : arr)
cout << i << " "; //输出靠背后整型数组arr的元素内容
cout << endl;
system("pause");
return 0;
}