Vectors problem

Hello. This is my problem:
http://i.imgur.com/usZl8kP.png
How do I do the sorting of both vectors?
Here's what I have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
class Name_pairs
{
public:
	void read_names(const int &num);
	void read_ages();
	void print();
	bool checknames(Name_pairs &temp, Name_pairs &temp2);
	
	
	
private:
	vector<int>ages;
	vector<string>names;
};
int main()
{
	Name_pairs mylist;
	int num;
	cin >> num;
	cin.ignore(1000, '\n');
	mylist.read_names(num);
	mylist.print();


	system("Pause");
	return 0;
}
void Name_pairs::read_names(const int &num)
{
	string temp;
	for (int i = 0; i < num; i++)
	{
		cout << "Name: ";
		getline(cin, temp);
		names.push_back(temp);
		read_ages();
	}
}
void Name_pairs::read_ages()
{
	int age; cout << "Age: "; cin >> age;
	ages.push_back(age);
	cin.ignore(1000, '\n');
}
void Name_pairs::print()
{
	for (int i = 0; i < names.size(); i++)
	{
		cout << names[i] << " " << ages[i] << endl;
	}
}
bool Name_pairs::checknames(Name_pairs &temp, Name_pairs &temp2)
{
	return temp.names < temp2.names;
}

Any hints?
Topic archived. No new replies allowed.