title: struggling with partial arrays
body: <p>Here's the question:</p>
  
  <p>Write a function called <code>deleteRepeats()</code> that has a partially filled array of characters as a formal parameter and that deletes all repeated letters from the array. Since a partially filled array requires two arguments, the function will actually have two formal parameters: an array parameter and a formal parameter of type <code>int</code> that gives the number of array positions used. When a letter is deleted, the remaining letters are moved forward to fill in the gap. This will create empty positions at the end of the array so that less of the array is used. Since the formal parameter is a partially filled array, a second formal parameter of type int will tell how many array positions are filled. This second formal parameter will be a call-by-reference parameter and will be changed to show how much of the array is used after the repeated letters are deleted. For example, consider the following code:</p>
  
  <pre><code>char a[10]; a[0] = 'a'; a[1] = 'b'; a[2] = 'a'; a[3] = 'c'; int size = 4;
  deleteRepeats(a, size);
  </code></pre>
  
  <p>After this code is executed, the value of a[0] is 'a', the value of a[1] is 'b', the value of a[2] is 'c', and the value of size is 3. (The value of a[3] is no longer of any concern, since the partially filled array no longer uses this indexed variable.) You may assume that the partially filled array contains only lowercase letters. Embed your function in a suitable test program.</p>
  
  <p>Here's what I've got so far. I just tried to work on the <code>deleteRepeats()</code> function:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  const int max_letters = 4;
  
  void deleteRepeats(char letters[], int size, int&amp; numberOfLetters);
  
  int main()
  {
      char string_of_letters[max_letters] = {'a','b','a','c'};
      int letter_count = 4;
  
  
  
      deleteRepeats(string_of_letters, max_letters, letter_count);
  
      for (int i=0; i&lt;letter_count; i++)
      {
          cout&lt;&lt;string_of_letters[i];
      }
  
      return 0;
  }
  
  void deleteRepeats(char letters[], int size, int&amp; numberOfLetters)
  {
      for (int i=0; i&lt;numberOfLetters; i++)
      {
          if (letters[i] == letters[i+1])
          {
              for (int i=0; i&lt;numberOfLetters; i++)
              {
                  letters[i+1] = letters[i+2];
              }
          }
  
      }
  }
  </code></pre>
  
  <p>So I'm just trying to get the function to delete the repeat letters set up correctly. And my approach here doesn't seem to work. How can I fix this?</p>