title: Print() function failing to output vector, whats wrong?
body: <p>So my job is to describe the functions that our teacher only gave us prototypes to for a phonebook assignment. He also gave us a built <code>main()</code> and we are not allowed to change his <code>main()</code> or prototypes, only describe them.  I'm working on the <code>void print()</code> function, the one near the bottom. The <code>cout</code> brackets <code>&lt;&lt;</code> are marked as an error. And if you guys have any tips on the <code>void erase()</code> function as well, I though of using the <code>void lookup()</code> function inside the <code>erase()</code>, but the problem is I'm supposed to erase the index and the lookup function returns the phone number, not the index.
  Listed first is the prototypes, then my work, then the main.</p>
  
  <p>PROTOYPES</p>
  
  <pre><code>    #ifndef PHONEBOOK_H
      #define PHONEBOOK_H
      #include &lt;string&gt;
      #include &lt;vector&gt;
      using namespace std;
  
      class Person
      {
      public:
          Person();
          Person(string new_name, int new_phone);
          string get_name() const;
          int get_phone() const;
          bool operator &lt; (Person p) const;
          void print() const;
  
      private:
          string name;
          int phone;
      };
  
      void add_people(vector&lt;Person&gt; &amp;phone_book);
      void erase(vector&lt;Person&gt; &amp;phone_book, string name);
      void sort(vector&lt;Person&gt; &amp;phone_book);
      void shuffle(vector&lt;Person&gt; &amp;phone_book);
      void reverse(vector&lt;Person&gt; &amp;phone_book);
      void print(vector&lt;Person&gt; &amp;phone_book);
      int lookup(const vector&lt;Person&gt; &amp;phone_book, string name);
      #endif
  </code></pre>
  
  <p>MY WORK</p>
  
  <pre><code>        #include &lt;iostream&gt;
          #include &lt;string&gt;
          #include &lt;vector&gt;
          #include &lt;time.h&gt;
          #include "phonebook.h"
  
          Person::Person()
          {
              name = "NONE";
              phone = 0000000;
  
          }
          Person::Person(string new_name, int new_phone)
          {
              name=new_name;
              phone=new_phone;
          }
          string Person::get_name() const
          {
              return name;
          }
          int Person::get_phone() const
          {
              return phone;
          }
          bool Person::operator &lt; (Person p) const
          {
              return name &lt; p.name;
          }
          void Person::print() const
          {
              cout &lt;&lt; endl &lt;&lt; name &lt;&lt; " " &lt;&lt; phone;
          }
  
          void add_people(vector&lt;Person&gt; &amp;phone_book)
          {
              cout &lt;&lt; "Please enter the new name: ";
              string s;
              getline(cin, s);
              cout &lt;&lt; "Please enter new number: ";
              int number;
              cin &gt;&gt; number;
              phone_book.push_back(Person(s,number));
          }
          void erase(vector&lt;Person&gt; &amp;phone_book, string name)
          {   
          }
          void sort(vector&lt;Person&gt; &amp;phone_book)
          {
          }
          void shuffle(vector&lt;Person&gt; &amp;phone_book)
          {
          }
          void reverse(vector&lt;Person&gt; &amp;phone_book)
          {
          }
          void print(vector&lt;Person&gt; &amp;phone_book)
          {
              for(int i=0; i &lt; phone_book.size(); i++)
                  cout &lt;&lt; phone_book[i] &lt;&lt; " ";
          }
  
          int lookup(const vector&lt;Person&gt; &amp;phone_book, string name)
          {
                  int i = 0;
                  while (i &lt; phone_book.size() &amp;&amp; phone_book[i].get_name() != name)
                  {
                      i++;
                      return phone_book[i].get_phone();
                  }
          }
  </code></pre>
  
  <p>THE MAIN</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;time.h&gt;
  #include "phonebook.h"
  
  using namespace std;
  
  
  
  
  int main()
  {
  
      vector&lt;Person&gt; phone_book;
      string name;
      int number;
      int answer;
  
      srand((int)(time(0)));
  
      phone_book.push_back(Person("Bruin, Joe", 5556456));
      phone_book.push_back(Person("Simpson, Homer", 5557471));
      phone_book.push_back(Person("Duffman, Barry", 5533331));
  
  
      cout &lt;&lt;"\n";
      cout &lt;&lt; "Your phone book contains the following names and numbers: \n";
  
      for (int i=0; i &lt; phone_book.size(); i++)
      {
  
          phone_book[i].print();
          cout &lt;&lt; "\n";
      }
      cout &lt;&lt;"\n";
      answer=0;
  
      while (answer != 8)
      {
          cout &lt;&lt; "\nChoose from the following options:\n\n";
  
          cout &lt;&lt; "1) Add people to the phone book.\n";
          cout &lt;&lt; "2) Erase a person from the phone book.\n";
          cout &lt;&lt; "3) Sort the phone book.\n";
          cout &lt;&lt; "4) Shuffle the phone book.\n";
          cout &lt;&lt; "5) Reverse the phone book.\n";
          cout &lt;&lt; "6) Print the phone book.\n";
          cout &lt;&lt; "7) Look up a person in the phone book.\n";
          cout &lt;&lt; "8) Quit.\n\n";
  
          cin &gt;&gt; answer;
  
          string clear;
  
          getline(cin, clear);
  
          if (answer == 1)
              add_people(phone_book);
          else if (answer == 2)
          {
              cout &lt;&lt; "Enter a name: ";
              getline(cin, name);
              erase(phone_book, name);
  
          }
          else if (answer == 3)
              sort(phone_book);
          else if (answer == 4)
              shuffle (phone_book);
          else if (answer == 5)
              reverse(phone_book);
          else if (answer == 6)
          {
              cout &lt;&lt;"\n";
              cout &lt;&lt; "Your phone book contains the following names and numbers: \n";
              print(phone_book);
          }
          else if (answer ==7)
          {                   
              cout &lt;&lt; "Enter a name: ";
              getline(cin, name);
              int number = lookup(phone_book, name); 
              if (number &gt; 0)
              {
                  cout &lt;&lt; "\n\nThe number for " &lt;&lt; name &lt;&lt; " is: " &lt;&lt; number &lt;&lt; "\n\n";
              }
              else
                  cout &lt;&lt; name &lt;&lt; " not found in the phone book.\n";
          }
      }
      return 0;
  }
  </code></pre>