.Array of Vectors

Discussion in 'C Programming' started by gio, Nov 10, 2007.

  1. gio

    gio

    Joined:
    Nov 10, 2007
    Messages:
    1
    Good morning to all!
    I'm a C++ new-newbie... and I have a problem :guru:
    i' ve to manage an array of vector:

    int NumCols=1;
    vector<int> a[NumCols];

    then i should initialize the first (and at all, only) element of the fisrt vector with 0 value.
    and so i write:

    a[0].push_back(0);

    But this give me an error
    Error: non class,struct,union object a[0] used with . or -> FILE:L.C LINE:165

    Could you give me some hint?

    After this i have to increment NumCols (in a cycle when some conditions are satisfied):

    for (i=1; i<jet.size(); i++){
    for (int cols=0; cols<NumCols; cols++){
    CalculateDR(jet, jet[a[cols].front()]);

    if (DR> DRref){
    NumCols++;
    a[NumCols].push_back(jet.Label);
    break;
    }

    if (DR <= DRref){
    a[cols].push_back(jet.Label);
    break;
    }
    }
    }


    as i ve already wrote, i m a newbie and so i suppose that there are many errors.....

    Thanks to all!
    gio
     
    gio, Nov 10, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jack.smith.sam@gmail.com

    Dynamic Array of vectors

    jack.smith.sam@gmail.com, Sep 29, 2006, in forum: Java
    Replies:
    8
    Views:
    13,638
    AlyBrat
    Apr 13, 2009
  2. Shannon
    Replies:
    2
    Views:
    529
    Shannon
    Feb 9, 2007
  3. Dan
    Replies:
    12
    Views:
    14,224
    devil_Jit
    Sep 26, 2010
  4. pauldepstein@att.net
    Replies:
    3
    Views:
    709
    Shadowman
    Mar 26, 2008
  5. Guest
    Replies:
    0
    Views:
    461
    Guest
    Sep 14, 2005
Loading...

Share This Page