title: Should I use printf in my C++ code?
body: <p>I generally use <code>cout</code> and <code>cerr</code> to write text to the console. However sometimes I find it easier to use the good old <code>printf</code> statement. I use it when I need to format the output. </p>
  
  <p>One example of where I would use this is:</p>
  
  <pre><code>// Lets assume that I'm printing coordinates... 
  printf("(%d,%d)\n", x, y);
  
  // To do the same thing as above using cout....
  cout &lt;&lt; "(" &lt;&lt; x &lt;&lt; "," &lt;&lt; y &lt;&lt; ")" &lt;&lt; endl;
  </code></pre>
  
  <p>I know I can format output using <code>cout</code> but I already know how to use the <code>printf</code>. Is there any reason I shouldn't use the <code>printf</code> statement?</p>