How do I extract the digits of a number in C++?
<p>Basically I would like to make a small little program that when u enter a number (say 145) it read the 3 digits and prints the largest one. </p>

<p>int a, b, c, max;</p>

<pre><code>cout &lt;&lt; "Enter a, b and c: ";
cin &gt;&gt; a &gt;&gt; b &gt;&gt; c;

max = a;
if (b&gt;max)
    max = b;
if (c&gt;max)
    max = c;
cout &lt;&lt; "Max is " &lt;&lt; max &lt;&lt; "\n";
</code></pre>

<p>I was think of using something like this, but I have no idea how to get the computer to read each individual digit.
thanks!</p>
