CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Help Please!

Threaded View

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Help Please!

    Hi I keep trying to run this procedure in my program, however it keeps telling me that it is calling a vector index out of bounds and im getting extremely frustrated as to why it is doing this. Any help would be greatly appreciated!
    Thanks,
    I attached the code for the procedure as well

    void merge(vector <string> & songs1, vector <string> & artists1,
    vector <int> & ratings1, vector <string> & songs2,
    vector <string> & artists2, vector <int> & ratings2)
    {
    bool not_dupl = true;
    for(int i = 0; i < songs2.size(); i++)
    {

    for(int j = 0; j < songs1.size(); i++)
    {
    not_dupl = false;
    if((songs2.at(i) != songs1.at(j)) and (artists2.at(i) != artists1.at(j)))
    {
    //adds songs to playlist
    not_dupl = true;

    }
    }
    if( not_dupl == true)
    {
    songs1.push_back(songs2.at(i));
    artists1.push_back(artists2.at(i));
    ratings1.push_back(ratings2.at(i));
    cout << songs1.size() <<' ' << songs2.size() << endl;
    }
    }
    return;
    }
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured