creating a telephone directory using the standard template library list or vector and multimap
<p>I have a simple telephone directory but i want to modify it so that i can search for a list for a lastname and it should return the firstnames that have the same lastname.One person can have more than one number, and one number can belong to more than one person (members of a family).a telephone number in general case can have non-numeric characters, for example if i have a list of names like this below</p>

<pre><code>john williams
smart williams
hendrix james
drey williams
</code></pre>

<p>if i enter williams or search williams it should return</p>

<pre><code>john williams
smart willams
drey williams
</code></pre>

<p>i want use <code>Map&lt;String,List&lt;String&gt;&gt;.</code></p>

<pre><code>class name {
  string str;
public:
  name() { 
      str = ""; 
  }
  name(string s) { 
      str = s; 
  }
  string get() { 
      return str; 
  }
};

// Define less than relative to name objects.
bool operator&lt;(name a, name b){
   return a.get() &lt; b.get();
}

class surname {
  string str;
public:
  surname() { 
      str = ""; 
  }
  surname(string s) { 
      str = s; 
  }
  string get() { 
      return str; 
  }
};

int main()
{
  map&lt;name, surname&gt; directory;

  directory.insert(pair&lt;name, surname&gt;(name("James"), surname("williams")));
  directory.insert(pair&lt;name, surname&gt;(name("Coz"), surname("williams")));
  directory.insert(pair&lt;name, surname&gt;(name("James"),  surname("trues")));
  directory.insert(pair&lt;name, surname&gt;(name("Tni"),surname("mutton")));

  // given a name, find number
  string str;
  cout &lt;&lt; "Enter name: ";
  cin &gt;&gt; str;

  map&lt;name, surname&gt;::iterator p;

  p = directory.find(name(str));
  if(p != directory.end()) 
    cout &lt;&lt; "surname: " &lt;&lt;  p-&gt;second.get();
  else
    cout &lt;&lt; "Name not in directory.\n";
    system("pause");

  return 0;
}
</code></pre>

<p>thanks in advance</p>
