Just learn to use the pair, if a function has two return worthy words, if the type is the same we can use the structure to return the value, if the type is different can also write their own structure to return the value, but C + + comes with such a return value pair,pair is essentially a structure, But it is much more convenient to use than the structure.
Definition method pair<int,int>p or pair<int, int >p (A, b);
The first is to define the function directly but not to assign a value to the function, and the second is to define the function and directly assign the value of the method, if not at the beginning of the assignment function P=make_pair (A, b);
Pair also stores three variables pair<int, pair<int, int > > Note the last two >> do not write together otherwise the system will be judged to be bit operations, (writing a good fan);
Pair use: Pair has two values, named First,second; When you use it, just call it right.
1#include <iostream>2 using namespacestd;3 intMain ()4 {5pair<int,int>p;6 intA=1, b=3;7p=Make_pair (A, b);8cout<<p.first<<" "<<P.second;9System"Pause");Ten return 0; One}
The use of the pair is probably the case, I do not have much to understand, especially if you still feel trouble can be a global variable simplified abbreviations such as # # MP Make_pair.
Use of pair