title: How do you input a string of a specific length?
body: <p>Let's say I were to allow the user to input <code>n</code>. They would then be able to input a string that must have <code>n</code> characters. I don't want to use a loop because the string must be on one line.</p>
  <p>Would there be a way to do this?</p>
  <p>This format is what I would prefer.</p>
  <pre><code>int n;
  cin &gt;&gt; n;
  
  string test;
  cin &gt;&gt; test[n];
  </code></pre>
  <p>Any help would be greatly appreciated :)</p>