title: How to make the char array the same size as the input (or can it be done using the string lib as opposed to C-style array strings)?
body: <p>So, I'm not really new to C++, but I rushed through all the tutorials in excitement, and now I'm going back and actually trying to apply my knowledge and build on it. I've been working on a small encryption algorithm; nothing special, just input, encrypt and output to the command prompt window.</p>
  
  <p>The problem is, I create a char array of, say, 9 variables. I then use cin.getline(array,8) to get user input of up to 8 characters. It's all good if I enter exactly 8. But, if I enter less, then there are random characters on the end of the inputted word.</p>
  
  <p>So, I was wondering if there's maybe a way to create the array the exact size of the characters entered? Or, even better, is there any way I could make an encryption algorithm using the C++ string library? I'm not sure how to change an individual character of a C++ string without converting it into a char array, so I'm pretty much back where I started. </p>
  
  <p>I know this is probably a stupid question, but I've already ended up back at basics twice after rushing through everything that I didn't understand, so I really want to make sure I know everything this time around.</p>
  
  <p>Any help is really appreciated :)</p>