vector and pairs

This is a discussion on vector and pairs within the C++ Programming forums, part of the General Programming Boards category; Code: for(i=1;i<=m;i++) { cin>>u>>v>>c; G[u].push_back(pair<int,int>(v,c) ); } i just started with it... my scenario is user gives another two i/p ...

  1. #1
    dpp
    dpp is offline
    Registered User
    Join Date
    Jan 2009
    Posts
    197

    vector and pairs

    Code:
    for(i=1;i<=m;i++)
        {
                         cin>>u>>v>>c;
         G[u].push_back(pair<int,int>(v,c) );
    
    
    }
    i just started with it...
    my scenario is user gives another two i/p say a ,b

    i have to check wat are all adjacent to a and reach b sumtime ..(at the end return sums of c in the path).. how do i do it using vector and pairs....

    a sample code or extension of this code would be helpful

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,993
    Quote Originally Posted by dpp
    my scenario is user gives another two i/p say a ,b

    i have to check wat are all adjacent to a and reach b sumtime ..(at the end return sums of c in the path)
    Write more clearly in English and elaborate on what you are trying to do.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21