‘cout’ does not name a type
<p>I was learning Adam Drozdek's book "Data Structures and Algorithms in C++", well, I typed the code in page 15 in my vim and compiled it in terminal of my Ubuntu 11.10.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstring&gt;
using namespace std;

struct Node{
    char *name;
    int age;
    Node(char *n = "", int a = 0){
        name = new char[strlen(n) + 1];
        strcpy(name, n);
        age = a;
    }
};

Node node1("Roger", 20), node2(node1);
cout &lt;&lt; node1.name &lt;&lt; ' ' &lt;&lt; node1.age &lt;&lt; ' ' &lt;&lt; node2.name &lt;&lt; ' ' &lt;&lt; node2.age;
strcpy(node2.name, "Wendy");
node2.name = 30;
cout &lt;&lt; node1.name &lt;&lt; ' ' &lt;&lt; node1.age &lt;&lt; ' ' &lt;&lt; node2.name &lt;&lt; ' ' &lt;&lt; node2.age;
</code></pre>

<p>But there's some error:</p>

<pre><code>oo@oo:~$ g++ unproper.cpp -o unproper
unproper.cpp:15:23: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
unproper.cpp:16:1: error: ‘cout’ does not name a type
unproper.cpp:17:7: error: expected constructor, destructor, or type conversion before ‘(’ token
unproper.cpp:18:1: error: ‘node2’ does not name a type
unproper.cpp:19:1: error: ‘cout’ does not name a type
</code></pre>

<p>I have searched <a href="http://stackoverflow.com/questions/3846333/c-does-not-name-to-a-type">this</a>,<a href="http://stackoverflow.com/questions/6153782/c-does-not-name-a-type">this</a>,<a href="http://stackoverflow.com/questions/7810773/error-does-not-name-a-type">this</a> and <a href="http://stackoverflow.com/questions/9597605/c-struct-does-not-name-a-type">this</a>, but I can't find the answer.</p>

<p>Any help would be appreciated:)</p>
