C++ filling array issue
<p>I have a function that fills an array based on user input</p>

<p>The program works fine in this test case but it asks the user for one more number than needed.</p>

<pre><code>void fill_array(char a[], int size)
{
char next;
const char SENTIEL ='.';
int index=0;
cin &gt;&gt; next;


  while ((next !=SENTIEL) &amp;&amp; (index &lt; size))
{
   a[index] = next;
   index++;
   cin &gt;&gt; next;

}

cout &lt;&lt; a[0];
cout &lt;&lt; a[1];
cout &lt;&lt; a[2];
cout &lt;&lt; a[3];
cout &lt;&lt; a[4];
cout &lt;&lt; a[5];
cout &lt;&lt; a[6];
cout &lt;&lt; a[7];
cout &lt;&lt; a[8];
cout &lt;&lt; a[9];   
}




int main()
{
int const MAX=10;
char b[MAX];
fill_array(b,MAX);
}
</code></pre>

<p>this returns the correct numbers but it has one more to ask.</p>
