There is a vector. Suppose vec=[0.1,0.2,0.8,23.1,0.1,0.2] . There is a step, let's say h=0.1 from zero to m (in general, just the maximum element in the vector that is bypassed) you need to go through the whole vector to count how many times the element corresponds to the current step and write the total number to another vector. I did it like this:
double j=0; B: int i=0; int n=0; for(j; j<=m; j=j+step) { A: for(i; i<=vec.size; i++) { if(vec[i]=j && i<vec.size()) { n++; goto A; } else(i==vec.size()) { vec1.pushback(n); goto B; } } } More than sure it's awful. Tell me, is there a more "competent" option?
go to A;andgo to B;o_O - Qwertiy ♦