title: Prints string on console with cout.write() function only after I Quit the application
body: <p>Inserting an string using cin.getline() and want to print that string on 
  console using cout.write().Prints the entered string after I quit the application    </p>
  
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;conio.h&gt;
  int main() {
  char str[20];
  cout&lt;&lt;"Enter a string:";
  cin.getline(str,20);
  cout&lt;&lt;"Entered string:";
  cout.write(str,20);
  cout.flush();
  getch();
  return 0;
  }
  </code></pre>