Splitting an integer to its digits I want to  split an integer of type unsigned long long to its digits.
Any comments and suggestions are always welcome.
#include &lt;iostream&gt;
#include &lt;string&gt;

#include &lt;vector&gt;

using namespace std;

vector&lt;unsigned short&gt; IntegerDigits(unsigned long long input)
{
    vector&lt;unsigned short&gt; output;
    const unsigned short n = log10(ULLONG_MAX);
    unsigned long long divisor = pow(10, n);
    bool leadingZero = true;

    for (int i = 0; i &lt; n + 1; i++)
    {
        unsigned short digit = input / divisor % 10;
        if (!leadingZero || digit != 0)
        {
            output.push_back(digit);
            leadingZero = false;
        }
        divisor /= 10;
    }

    return output;
}

void main()
{
    vector&lt;unsigned short&gt; output = IntegerDigits(ULLONG_MAX);

    cout &lt;&lt; ULLONG_MAX &lt;&lt; &quot;: [&quot;;
    for (auto y : output)
        cout &lt;&lt; y &lt;&lt; &quot;, &quot;;
    cout &lt;&lt; &quot;\b\b]&quot;;

    cout &lt;&lt; &quot;&quot;&lt;&lt;endl;

}
Avoid mixing floating point and integer arithmetic
As mentioned by greybeard, there is a potential problem here:
const unsigned short n = log10(ULLONG_MAX);

ULLONG_MAX is larger than can be exactly represented by a double. This means the result might not be what you expect. The same goes for pow(10, n). While you can compensate for it, it is better to find a way to calculate the length of a number without using floating point math.
Keep it simple
Unless performance is a big concern, keep it simple. You don't have to know the number of digits up front if you push trailing digits to the front of the vector, like so:
vector&lt;unsigned short&gt; IntegerDigits(unsigned long long input)
{
    vector&lt;unsigned short&gt; output;

    while (input)
    {
        output.insert(output.begin(), input % 10);
        input /= 10;
    }

    // Handle input being equal to 0
    if (output.empty())
    {
        output.push_back(0);
    }

    return output;
}

Pushing to the front of a std::vector is less efficient, but on the other hand you don't need the double&lt;-&gt;int conversions, and you don't need to handle the leading zeros inside the loop.
Avoid using std::endl
Prefer using &quot;\n&quot; over std::endl, the latter is equivalent to the former, but also forces a flush of the output, which can be bad for performance.
Avoid backspaces in the output
You used a neat trick to get rid of the last comma without having to have extra logic inside the for-loop in main(). However, consider that the output might not just be for human consumption, but is written to a file and/or is parsed by another program. In that case, the \b characters are probably unexpected and might cause problems.