title: How to read cin into a dynamic array?
body: <p>I'm trying to store a string entered by the user into a dynamic array. For "normal" arrays, you simply use the get function as I've used it here and everything works fine. However it seems that this doesn't work for dynamic arrays. When compiled, the program basically just skips the whole input segment and moves on to what comes after it. It doesn't even pause to let me type anything. So how do I store cin input into a dynamic array? Note: This is for a specific assignment, so please don't tell me to use a string or a non-dynamic array; I can't.</p>
  
  <pre><code>int arraySize;
  cout &lt;&lt; "Enter a maximum length for the string: ";
  cin &gt;&gt; arraySize;
  arraySize += 1;
  
  char *inputPtr;
  inputPtr = new char[arraySize];
  
  cout &lt;&lt; "Enter a string to be converted: ";
  cin.get(inputPtr, arraySize);
  </code></pre>