Q:

Condition in "if" ignored in "for" loop

For below code, when input is:

first input = 0 1 2 3 4 5 6 7 8 9
second input = 1 2 3 4 5 6 7 8 9 10

it will produce output of:

first output = 0
second output = 1

instead of taking each input quartile it take its first element, and the problem is (after testing and such), it follow with the problem in code 
for (vector<int>::size_type counter = 0; (quartiles < quadro) && (counter < numstore.size()); ++counter)
{
    if (counter == (quartiles/quadro * numstore.size()))
    {
        quaele.push_back(numstore[counter]);
        if ((quartiles == 2) && (numstore.size() / 2 == 0))
            quaele[quartiles-1] = (numstore[counter]+numstore[counter-1]) / 2;
        ++quartiles;
    }
    // test
    cout << quartiles;
}

where the conditional in "if function" doesn't work, I mean on first loop, counter == 0, how can 0 == 1(quartiles)/4(quadro) * 10(numstore.size()??

A:

Because quartiles and quadro are both integers and the first is always less than the second (because that's what the for statement says), the expression:
quartiles / quadro * numstore.size()

will always be equal to zero, because quartiles / quadro is calculated first. Hence, the if statement will only ever be true the first time through the loop.
You may be able to get around this by re-arranging the calculation:
quartiles * numstore.size() / quadro

