a vector can push and pop objects as it can with built-in data.
if we create only one vector we can push in it datta:
std::vector<int> vecInt; // vector of integers
std::vector<int> vecInt[4]; // an array of vectors to integers
so the array of vectors is like a multi-dimensional array. so to access the data we double the subscript operator `[][]`:
vecInt[0].push_back(5);
cout << vecInt[0][0]; // the first for first vector in the array and the second index is for the first data in the first vector in the array.
in your example you have an array to vectors to struct coffeebeen:
std::vector<coffeeBean> coffee_vec[4];
int main(int argc, char ** argv)
{
coffeeBean cofB = { "Raindrop7", "England", 5 };
coffee_vec[0].push_back(cofB); // push the object in the first vector in the array
cout << (coffee_vec[0][0]).name << endl;
cin.get();
return 0;
}