title: Read input in c++
body: <p>Im very new to c++ and trying to take my first steps. In my problem I need to read 3 integers and do something with it. So, to take this integers I wrote:</p>
  
  <pre><code>int a, b, n;
  scanf("%i%i\n", &amp;a, &amp;b);
  scanf("%i", &amp;n);
  </code></pre>
  
  <p>and also I tried:</p>
  
  <pre><code>scanf("%i%i", &amp;a, &amp;b);
  scanf("%i", &amp;n);
  </code></pre>
  
  <p>but he always gives me some random large integer for n.
  input:</p>
  
  <pre><code>7 13
  1
  </code></pre>
  
  <p>ty</p>
  
  <p>if I write</p>
  
  <pre><code>freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  
  int a, b, n;
  cin &gt;&gt; a &gt;&gt; b;
  cin &gt;&gt; n;
  printf("%i", n);
  return 0;
  </code></pre>
  
  <p>It doesnt work. As same as</p>
  
  <pre><code>freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  
  int a, b, n;
  scanf("%i%i", &amp;a, &amp;b);
  scanf("%i", &amp;n);    
  printf("%i", n);
  return 0;
  </code></pre>