title: Align columns output c++
body: <p>I want read a file where there are the names of AC Milan's players and their date of birth. I want display this in two aligned columns. I tried to use setw() and left but the result isn't what I want. This is the code that I used for read and print:</p>
  
  <pre><code>void read(char filename[]){
      fstream mio_file;
      char c;
      bool start_name = true;
      bool start_date = true;
  
      mio_file.open(filename, ios_base::in | ios_base::binary);
  
      mio_file.read(&amp;c, sizeof(char));
      while(!mio_file.eof()){
  
          if(c &gt;= 'A' &amp;&amp; c &lt;= 'z' &amp;&amp; start_name){
              cout &lt;&lt; endl &lt;&lt; "Name : ";
              start_name = false;
              start_date = true;
          }
          if(c &gt;= '0' &amp;&amp; c &lt;= '9' &amp;&amp; start_date){
              cout &lt;&lt; setw(25) &lt;&lt; left &lt;&lt; "Date of birth : ";
              start_date = false;
              start_name = true;
          }
  
          cout &lt;&lt; c;
          mio_file.read(&amp;c, sizeof(char));
      }
  
      mio_file.close();
  }
  </code></pre>
  
  <p>This is output : </p>
  
  <p><a href="https://i.stack.imgur.com/se7n3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/se7n3.png" alt="enter image description here"></a></p>
  
  <p>And this is output that I want :</p>
  
  <p><a href="https://i.stack.imgur.com/JoDyr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JoDyr.png" alt="enter image description here"></a></p>