title: Input string in char array C++
body: <p>This is my code:</p>
  
  <pre><code>char A[10];
  char B[5];
  cin &gt;&gt; setw(10) &gt;&gt; A;
  cin &gt;&gt; setw(5) &gt;&gt; B;
  
  cout &lt;&lt; A;
  cout &lt;&lt; B;
  </code></pre>
  
  <p>If the input exceeds the array size (ex: 10 for <code>A</code> variable), then the program does not prompt me to enter the data for the second one. It goes right to the the end and execute the two "cout" lines.</p>
  
  <p>Input: <code>abcabcabcabcabcabc</code> (for A)</p>
  
  <p>Output: <code>abcabcabcabca</code> (13 space for char + 2 '\n')</p>
  
  <p>Output expected:</p>
  
  <p><code>abcabcabc</code> (for A)<br>
  <code>dddd</code> (for B) </p>
  
  <p>I want to enter data for both variables even if I entered too many characters for one of them</p>