I have a very simple for if loop which takes in an array (a vector of vectors) called data, reads the 0th element of EACH row (i.e. the data[i][0] elements), and outputs the 5th elements of THAT specific row IFF it satisfies the condition that the first element is equal to an integer pid (user defined earlier in the code.) If the row doesn't start with that element, i want it to output nothing.
Here is my code for this loop:
for(int i = 0; i < data.size(); i++) {
if(data[i][0] = pid) {
cout << data[i][5] << endl;
}
}
However, when I run the program, it outputs the 5th element of EVERY row, not just the ones that start with pid. AKA, c++ seems to be completely ignoring my if statement.
Does anyone have an answer to this?
Thank you in advance!