So far every variable has held one value: a number, a character, a string. But the things a program describes often come in bundles. A child in a line-up has a name and a height. A point on the plane has an x and a y. A book has a title, a year and a page count. This lesson is about keeping such values together in one variable, so they can't be separated by accident.
Why bundle values
Say we have the names and heights of the children in a class and want the tallest one — name and height. With what you know, you would read them into two vectors:
They are tied only by their index: names[3] goes with heights[3]. That works
until something moves. Sort heights and every name now points at the wrong
number; swap two children in one vector and forget the other, and the data is
quietly wrong forever. The fix is to make one value out of the two.
pair: two values in one variable
A pair holds exactly two values, which may have different types. The two
halves are called first and second:

The same pair can be written in one line, in either of two ways. The braces are
shorter; make_pair is what you will see in older code. They mean the same:
cout doesn't know how to print a pair and cin doesn't know how to read one,
so the halves are printed and read separately: cin >> p.first >> p.second;.
Week 7's swap works on pairs too: swap(p.first, p.second) exchanges the two
halves of one pair, and swap(p, q) exchanges two whole pairs.
A vector of pairs
Pairs become really useful when there are many of them. One vector<pair<string, int>>
holds the whole class, and a name can never drift away from its height:
kids[i] is one child; kids[i].second is that child's height. Finding the
tallest is the Week 4 maximum loop, except that the thing being compared is
.second and the thing being printed is .first:
