Hello everyone,
I want to assign a value to a component of an array by excluding some of indices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
vector<int>save;
for (int o = 0; o < nbOdds; ++o) {
for (int t = 0; t < nbWays; ++t) {
if (S[o][3] == 1) {
save.push_back(o);
}
}
}
for (int o = 0; o < nbOdds; ++o) {
for (int t = 0; t < nbWays; ++t) {
if(o!= save[o]) // this is not correct
S[o][t]=5;
}
}}
In the first loop, I save the the odds when they are equal to 1 in period 3. In the second loop, I want to assign the value 5 the remaining odds, I mean I try to assign values 5 by excluding save vector
Thank you so much .Not exactly ,actually it is y mistake , I edited my code. The t indexes vary according to the o. So, I should exclude the o which are equal to 1 in period 3, what I did in save. I need to find remaining o, I should assign value 5 in their time windows , which is starting[o] and nbWays[o]