title: lining up a table using precision rules c++
body: <p>I am simply trying to make my console out look like the attached picture. trying to left justify, or something similar to make time and speed more in line with the table. Please help me figure out exactly what I need to do, to make my output look exactly like the attached image.</p>
  
  <p><a href="https://i.stack.imgur.com/UHxLx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UHxLx.jpg" alt="racerassignment"></a></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  
  int main(void)
  
  {
  
      char RacerName [20];
      int checkPointOneTime;
      int checkPointTwoTime;
      int checkPointThreeTime;
      int checkPointFourTime;
      int finishTime;
  
  
      cout &lt;&lt; "Enter the racer's first name: ";
      cin &gt;&gt; RacerName;
      cout &lt;&lt; "Enter the time (in minutes) at Check Point 1: ";
      cin &gt;&gt; checkPointOneTime;
      cout &lt;&lt; "Enter the time (in minutes) at Check Point 2: ";
      cin &gt;&gt; checkPointTwoTime;
      cout &lt;&lt; "Enter the time (in minutes) at Check Point 3: ";
      cin &gt;&gt; checkPointThreeTime;
      cout &lt;&lt; "Enter the time (in minutes) at Check Point 4: ";
      cin &gt;&gt; checkPointFourTime;
      cout &lt;&lt; "Enter the time (in minutes) at the Finish Line: ";
      cin &gt;&gt; finishTime;
  
      cout &lt;&lt; "\nLOTOJA After Action Review for John" &lt;&lt; endl &lt;&lt; endl;
  
      cout &lt;&lt; setw(24) &lt;&lt; "Interval Details" &lt;&lt; endl &lt;&lt; endl;
  
      int checkPointOneDistance = 44;
      int checkPointTwoDistance = 87;
      int checkPointThreeDistance = 128;
      int checkPointFourDistance = 165;
      int checkPointFinalDistance = 207;
  
      int checkPointOneInterval = checkPointOneDistance;
      int checkPointTwoInterval = checkPointTwoDistance - checkPointOneDistance;
      int checkPointThreeInterval = checkPointThreeDistance - checkPointTwoDistance;
      int checkPointFourInterval = checkPointFourDistance - checkPointThreeDistance;
      int checkPointFiveInterval = checkPointFinalDistance - checkPointFourDistance;
  
      int checkPointTimeOneInterval = checkPointOneTime;
      int checkPointTimeTwoInterval = checkPointTwoTime - checkPointOneTime;
      int checkPointTimeThreeInterval = checkPointThreeTime - checkPointTwoTime;
      int checkPointTimeFourInterval = checkPointFourTime - checkPointThreeTime;
      int checkPointTimeFiveInterval = finishTime - checkPointFourTime;
  
      float minutesInHours = 60.0;
  
      float speedIntervalOne = checkPointOneDistance / (checkPointTimeOneInterval / minutesInHours);
      float speedIntervalTwo = checkPointTwoInterval / (checkPointTimeTwoInterval / minutesInHours);
      float speedIntervalThree = checkPointThreeInterval / (checkPointTimeThreeInterval / minutesInHours);
      float speedIntervalFour = checkPointFourInterval / (checkPointTimeFourInterval / minutesInHours);
      float speedIntervalFive = checkPointFiveInterval / (checkPointTimeFiveInterval / minutesInHours);
  
  
      cout &lt;&lt; setw(11) &lt;&lt; "Location" &lt;&lt; setw(17.5) &lt;&lt; " Distance" &lt;&lt; setw(16.5) &lt;&lt; " Time" &lt;&lt; setw(18) &lt;&lt; " Speed" &lt;&lt; endl;
      cout &lt;&lt; "Interval 1" &lt;&lt; setfill('.') &lt;&lt; setw(16) &lt;&lt; checkPointOneInterval &lt;&lt; setfill (' ') &lt;&lt; setw(16.5) &lt;&lt; checkPointTimeOneInterval &lt;&lt; setw(20) &lt;&lt; setprecision(3) &lt;&lt; fixed &lt;&lt; speedIntervalOne &lt;&lt; endl;
      cout &lt;&lt; "Interval 2" &lt;&lt; setfill('.') &lt;&lt; setw(16) &lt;&lt; checkPointTwoInterval &lt;&lt; setfill(' ') &lt;&lt; setw(16.5) &lt;&lt; checkPointTimeTwoInterval &lt;&lt;  setw(20) &lt;&lt; setprecision(3) &lt;&lt; speedIntervalTwo &lt;&lt; endl;
      cout &lt;&lt; "Interval 3" &lt;&lt; setfill('.') &lt;&lt; setw(16) &lt;&lt; checkPointThreeInterval &lt;&lt; setfill(' ') &lt;&lt; setw(16.5) &lt;&lt; checkPointTimeThreeInterval &lt;&lt; setw(20) &lt;&lt; setprecision(3) &lt;&lt; speedIntervalThree &lt;&lt; endl;
      cout &lt;&lt; "Interval 4" &lt;&lt; setfill('.') &lt;&lt; setw(16) &lt;&lt; checkPointFourInterval &lt;&lt; setfill(' ') &lt;&lt; setw(16.5) &lt;&lt; checkPointTimeFourInterval &lt;&lt; setw(20) &lt;&lt; setprecision(3) &lt;&lt; speedIntervalFour &lt;&lt; endl;
      cout &lt;&lt; "Interval 5" &lt;&lt; setfill('.') &lt;&lt; setw(16) &lt;&lt; checkPointFiveInterval &lt;&lt; setfill(' ') &lt;&lt; setw(16.5) &lt;&lt; checkPointTimeFiveInterval &lt;&lt; setw(20) &lt;&lt; setprecision(3) &lt;&lt; speedIntervalFive &lt;&lt; endl;
  
      int totalRaceCheckPoints = 5;
      float totalAverageSpeed = checkPointFinalDistance / static_cast&lt;float&gt;(finishTime / minutesInHours);
  
      cout &lt;&lt; "\nThe average speed for the entire course was " &lt;&lt; totalAverageSpeed &lt;&lt; " mph. " &lt;&lt; endl &lt;&lt; endl;
  
      return 0;
  
  }
  </code></pre>