title: C++ string centering alignment
body: <pre><code>std::vector&lt;std::string&gt; voters;
  
  void LogVoters()
  {
      if (voters.size() &gt; 0)
      {
          std::string out;
  
          out.append(&quot;\n&quot;); // newline at start
  
          std::cout &lt;&lt; &quot;Vote results: &quot;;
          for (auto v : voters)
          {
              char formated_string[256];
              std::snprintf(formated_string, sizeof(formated_string), &quot;%s \n&quot;, v.c_str());
              out.append(formated_string);
          }
          std::cout &lt;&lt; out.c_str();
          voters.clear();
      }
  }
  
  int main() { // this gets called multiple times, thats why in voters string vector will be more names
      
      std::string player_name = &quot;IdontNeedName1337&quot;; // some random name
      
      int vote_option         = 0;
  
      char formated_string[256];
      std::snprintf(formated_string, sizeof(formated_string), &quot;%6s voted %6s&quot;, player_name.c_str(), !vote_option ? &quot;YES.&quot; : &quot;NO.&quot;);
      
      voters.push_back(formated_string);
      
      LogVoters();
  }
  </code></pre>
  <p>output is like</p>
  <pre><code>    IdontNeedName1337   voted   YES.
      ElonUsk102   voted   NO.
  </code></pre>
  <p>I want</p>
  <pre><code>    IdontNeedName1337   voted   YES.
      ElonUsk102          voted    NO.
  </code></pre>
  <p>I want to center it like this, please help</p>
  <p>edit: this is how it works
  so please help me god
  &quot;
  It looks like your post is mostly code; please add some more details.&quot; anoying</p>