C++: sorting struct based on one of each property
<p>I am a Java and C# programmer. Recently, I am working on C++ project. I am having a problem of how to write the sample code following in C++. The sample code following is to sort a property of a struct:</p>

<pre><code>public struct Person
{
    public string name;
    public int age;
}
</code></pre>

<p>Add some Persons to a list and sort by the age:</p>

<pre><code>static void main()
{
   List&lt;Person&gt; persons = new List&lt;Person&gt;();

   Person person = new Person();
   person.age = 10;
   person.name = "Jane";

   persons.Add(person);

   person = new Person();
   person.age = 13;
   person.name = "Jack";

   persons.Add(person);

   person = new Person();
   person.age = 12;
   person.name = "Anna";

   persons.Add(person);

   // sort age
   persons.Sort(delegate(Person p1, Person p2) 
   { return p1.age.CompareTo(p2.age); });

   persons.ForEach(delegate(Person p) 
   { Console.WriteLine(String.Format("{0} {1}", p.age, p.name)); });
</code></pre>

<p>}</p>

<p>Thanks in advance and I am very appreciated for your help to learn more about C++.</p>

<p>Could you please help me to write an equivalent sample code in C++?</p>

<p>Thanks in advance</p>
