title: In C++: How to overwrite an element to an array by moving entries below it up by one
body: <p>I am trying to "delete" an element in my array. I have been told by those who know C++ better than I do that to accomplish this I must move all entries below the one I want to delete up by 1. Afterwards, I must decrease by 1 the variable keeping track of the size of the array. So I wrote this code to accomplish that:</p>
  
  <pre><code>cout &lt;&lt; "Type the number of the inventory entry you would like to delete:\n";
          cin &gt;&gt; entryToDelete;
  
          for ( count = 0 ; count &lt; (entryToDelete - 1) ; count++)
                  list[count] = list[count + 1];
  
  position--;
  </code></pre>
  
  <p>I previously displayed for the user the entries in the array as #1, #2, #3, etc while their subscripts are 0, 1, 2, etc... That is why I put <code>entryToDelete - 1</code>. <code>position</code> is the variable that keeps track of the size of the array. Anyway, I use this code to output the array so I can check if the code worked:</p>
  
  <pre><code>for (int count = 0 ; count &lt;= position ; count++)
          {
                  cout &lt;&lt; "Entry #" &lt;&lt; (count + 1) &lt;&lt; endl;
                  cout &lt;&lt; "ISBN: " &lt;&lt; list[count].ISBN &lt;&lt; endl
                       &lt;&lt; "Author: " &lt;&lt; list[count].Author &lt;&lt; endl
                       &lt;&lt; "Title: " &lt;&lt; list[count].Title &lt;&lt; endl
                       &lt;&lt; "Quantity: " &lt;&lt; list[count].Quantity &lt;&lt; endl
                       &lt;&lt; "Price: " &lt;&lt; list[count].Price &lt;&lt; endl &lt;&lt; endl;
          }
  </code></pre>
  
  <p>For some reason, no matter what number I input to delete, the last element in the array is deleted. I have tried several modifications, such as changing the order of the array elements to modify: i.e. <code>list[count + 1] = list[count]</code>, but this does not give me what I want.</p>
  
  <p>Unfortunately, I am restricted from using vectors. </p>