I want to show the index number in which certain information is positioned in a vector. I made a for to calculate which is the person who has the least amount of children and how many are. Once I get the least amount of children, I want to say who is the least. That's why I want to show the value of p.
for(int p=1;p<=5;p++){
if (vector_numeroDeHijos[p]<menorTotal) {
menorTotal=vector_numeroDeHijos[p];
}
}
That is, if I set p to a value, I get what is in that position of the vector. What I want here is to get the value of p (not what is there). How can I do?