1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
struct identifiant {int a;int b;int c; };
int main()
{
std::vector<std::vector<identifiant> > MonVect;
std::vector< identifiant > vect;
identifiant L,K, M, F;
L.a=1;L.b=5;L.c=20;
K.a=2;K.b=20;K.c=2;
M.a=9;M.b=8;M.c=3;
F.a=10;F.b=10;F.c=10;
// On met L et M
vect.push_back(L);
vect.push_back(M);
MonVect.push_back(vect);
// On insère K entre les deux :
vect.push_back(K);
MonVect.push_back(vect);
vect.insert(vect.begin(), F);
MonVect.push_back(vect);
for(unsigned int i(0);i<MonVect.size();++i){
for(unsigned int j(0);j<MonVect[i].size();++j)
{
cout << MonVect[i][j].a << " , ";
}
cout << endl;
}
return 0;
} |
Partager