c++ - Running through two lists, and setting the value of matches to the proper index of a vector -


i have project i'm working on, , can't figure out best, or way this.

originally, had things hard coded i'm wanting move 1 reads list, reads list fine , adds them 2 vectors correctly, getting values proper place in third vector giving me problems.

edit

i've got adding names correctly now, it's doing without color should added special names.

    (int = 0; < 30; i++){         (int k = 0; k < list.size(); k++){             if (playname == list[k]){                 playname = colorlist[k] + list[k];                  char* playname2 = new char[playname.length() + 1];                 strcpy(playname2, playname.c_str());                  player_names.push_back(playname2);                 break;             }             else if (playname != list[k]){                 char* playname2 = new char[playname.length() + 1];                 strcpy(playname2, playname.c_str());                  player_names.push_back(playname2);                 break;             }         }     } 

any ideas?

i figured out causing me problems. code working fine,

for (int = 0; < 30; i++){     (int k = 0; k < list.size(); k++){         if (playname == list[k]){             playname = colorlist[k] + list[k];              char* playname2 = new char[playname.length() + 1];             strcpy(playname2, playname.c_str());              player_names.push_back(playname2);             break;         }         else if (playname != list[k]){             char* playname2 = new char[playname.length() + 1];             strcpy(playname2, playname.c_str());              player_names.push_back(playname2);             break;         }     } } 

but above it, code didn't need post didn't see loop until today. running 30 times, 30 runs another, , 1 4 list. removing loop caused work fine.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -