title: ios_base::sync_with_stdio(false) does not work between two inputs from stdin
body: <p>I am wondering why does the following code not work as expected:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main(){
      int n;
      string s;
      //scanf("%d",&amp;n);
      cin &gt;&gt; n;
      ios_base::sync_with_stdio(false);
      cin &gt;&gt; s;
      cout &lt;&lt; n &lt;&lt; " " &lt;&lt; s;
      return 0;
  }
  </code></pre>
  
  <p>Input: </p>
  
  <pre><code>10 
  abcd 
  </code></pre>
  
  <p>Output: <code>10</code></p>
  
  <p>The string is not getting printed! The result is same if I use <code>scanf</code> to input the integer. However, the code does work as expected if the line <code>ios_base::sync_with_stdio(false);</code> is placed before the first <code>cin</code> (or before the <code>scanf</code>) instead.</p>
  
  <p>I would highly appreciate any help to clarify this behaviour.</p>
  
  <p><strong>Edit:</strong>
  The inputs are contained in a file <code>inp.txt</code> and I am using <code>&lt;</code> (re-direction operator) to read from the file and <code>&gt;</code> to output the result to <code>out.txt</code>, like:
  <code>a.out &lt; inp.txt &gt; out.txt</code></p>
  
  <p>The code gives expected output if the inputs are given directly from console. Sorry for any misunderstanding or confusion.</p>