title: C++ How do I format a line of text that contains variable integers so that it is right aligned within a given width?
body: <p>The formatting goal is as follows</p>
  
  <pre><code>   Absolute value of the number you entered : 723
                   Square root of that number : 26.89
         Rounding this to the nearest integer : 27
    Two random numbers between 27 and 723 are : ...
  </code></pre>
  
  <p>This is my code as it stands</p>
  
  <pre><code>  cout &lt;&lt; right &lt;&lt; setw(50) &lt;&lt; "Absolute value of the number you entered : " &lt;&lt; absoluteValue &lt;&lt; endl;
    cout &lt;&lt; right &lt;&lt; setw(50) &lt;&lt; "Square root of that number : " &lt;&lt; squareRoot &lt;&lt; endl;
    cout &lt;&lt; right &lt;&lt; setw(50) &lt;&lt; "Rounding this to the nearest integer : " &lt;&lt; roundedSquareRoot &lt;&lt; endl;
    cout &lt;&lt; right &lt;&lt; setw(50) &lt;&lt; "Two random numbers between " &lt;&lt; roundedSquareRoot &lt;&lt; " and " &lt;&lt; absoluteValue &lt;&lt; " are : ";
  </code></pre>
  
  <p>When I run I get this</p>
  
  <pre><code>   Absolute value of the number you entered : 723
                   Square root of that number : 26.89
         Rounding this to the nearest integer : 27
                     Two random numbers between 27 and 723 are :
  </code></pre>
  
  <p>The bottom most line right align and setw() only apply to the first "text"
  How do I make it apply to everything on that line?
  Thanks</p>
  
  <p>Edit: To be clear, I just want the bottom line to act like the top three.</p>