title: Creating a password generator in c++ that saves the password in a .txt
body: <p>Over the past day I have been creating a password generator that after generating a password gives you an option to save that password to a .txt file.</p>
  
  <p>Everything is working except for the generating/printing the password in the Terminal and in the .txt file, after typing the length of the password, it generates it, but doesn't print.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>/* 
      Password generator by Yataga
  
      github.com/yataga
  
      twitter.com/yataga7
  
  */
  
  #include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  int main() {
      ofstream SavePass;
      char yn;
      const char TrueSelect = 'y';
      int SelectLengthInput;
      string pwd = "0aAbB1cCdD1eEf2F2gG3hHiIjJk3K45lLmM9n5N6o4OpPqQ76rRsStT78uUvVwW98xXyY0zZ";
      string password;
      cout &lt;&lt; "Welcome to Yataga's random password generator" &lt;&lt; endl;
      cout &lt;&lt; "Type the size of yout random password" &lt;&lt; endl;
      cin &gt;&gt; SelectLengthInput;
      cout &lt;&lt; "generating your password....."&lt;&lt;endl;
      for(int i = 0; i&lt;SelectLengthInput; i++) {
          password[i] = pwd[rand()%72];
      }
      cout&lt;&lt; "Your Password is: "&lt;&lt;password&lt;&lt;endl;
      cout&lt;&lt; "do you want to save this password in a file? (y/n): ";
      cin&gt;&gt;yn;
      if(yn == TrueSelect)
      {
          SavePass.open("passwords.txt");
          SavePass &lt;&lt; password;
          SavePass.close();
          cout&lt;&lt; "Password saved on password.txt"&lt;&lt;endl;
      }
      else
      {
          cout&lt;&lt; "Thanks for using my generator!";
      }
      return 0;   
  }
  </code></pre>