how to use find function of vectors to find a pair

Discussion in 'C' started by cimon, Jul 16, 2008.

Thread Status:
Not open for further replies.
  1. cimon

    cimon New Member

    Joined:
    Feb 9, 2007
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    Hello all

    I am declaring a 2 dimensional vector like this

    vector <int> components(numodnodes);
    vector <int> coordinates(2,components(numofnodes));

    as we know find function can be used with vector to find a particular value.
    like this
    if (find (marks.begin(), marks.end(), 0) == marks.end())
    {
    // 0 is not found in the sequence
    }


    above marks was a one dimensional vector

    as in my defination , I have a 2 dimensional vector with number of rows =2, and number of columns = number of nodes.

    is ther any way that I can use this find function to find a pair,(like (2,4)) rather than a single number like this

    if (find (cordinates.begin(), marks.end(), (2,4)) == marks.end())
    {
    // (2,4) is not found in the sequence
    }

    or what is the right method, to know if both numbers 2 and 4 are present at same column. that is (2,4) pair is present or not

    Thank you
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice