adjusting the distance between numbers on console
<p>I've made a program to create the pascal's triangle. the program takes number of rows as input and displays the triangle on the console. I've used the <code>setw()</code> function to set the distance between numbers. it's of for unit single digits but when the numbers get greater than 10,the width is not being adjusted properly,right now I've :</p>

<pre><code>if(P&lt;10){
   std::cout &lt;&lt; P ;
   std::cout &lt;&lt;std::setw(2);
}

if(P&gt;=10){
   std::cout&lt;&lt;std::setw(3) &lt;&lt; P ;
   std::cout&lt;&lt;std::setw(2);
}
</code></pre>

<p>here's the ouput from the console:</p>

<pre><code>                      1
                     1 1
                    1 2 1
                   1 3 3 1
                  1 4 6 4 1
                 1 5 10 10 5 1
                1 6 15 20 15 6 1
               1 7 21 35 35 21 7 1
              1 8 28 56 70 56 28 8 1
             1 9 36 84126126 84 36 9 110
</code></pre>

<p>I want it to appear like a proper triangle,Could someone help me out please???</p>
