title: C++ namespace and include
body: <p>Why do we need both <code>using namespace</code> and <code>include</code> directives in C++ programs?</p>
  
  <p>For example, </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main() {
   cout &lt;&lt; "Hello world";
  }
  </code></pre>
  
  <p>Why is it not enough to just have <code>#include &lt;iostream&gt;</code> or just have <code>using namespace std</code> and get rid of the other?</p>
  
  <p>(I am thinking of an analogy with Java, where <code>import java.net.*</code> will import everything from <code>java.net</code>, you don't need to do anything else.)</p>