是添加的第一个元素arr1
吗?
cout
给我一个错误。我究竟做错了什么?
#include <iostream>
using std::cin; using std::cout; using std::endl;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <cstddef>
using std::size_t;
int main ()
{
vector <int> ivec1; //defines a vector named ivec1 to hold values not yet defined
int arr1 [5] = {10, 20, 30 , 40, 50}; // defines array named arr1 with 5 values
ivec1.push_back (arr1 [0]);
cout << ivec1 << endl;
return 0;
}