How do I find the max frequency of a number of an integer? : <p>This is the code that I have so far: </p>

<pre><code> #include &lt;iostream&gt;

    #define MAX(X,Y) ((X) &gt; (Y) ? (X):(Y))

    int frequency(int n);

    int main()
    {
        int x;

        std::cout &lt;&lt; "Please enter a sequence of numbers."
            &lt;&lt; std::endl;
                std::cin &gt;&gt; x;

        std::cout &lt;&lt; "The max frequency of " &lt;&lt; x &lt;&lt; " is "
              &lt;&lt; frequency(x)
                &lt;&lt; std::endl;

        return 0;
    }

    int frequency(int n)
    {
        int A[10] = {0}, rem;

        while (n != 0)
        {
            int rem = (n % 10);
            A[rem] += 1;
            n = (n / 10);
            std::cout &lt;&lt; rem &lt;&lt;  '\t' &lt;&lt; n
                &lt;&lt; std::endl;
        }
        //MAX(A[rem], n);
    }
</code></pre>

<p>How can I modify this so that it prints out the the digit that has the most occurrence in an integer specified by a user?</p>
