/* Here I will write down some of my answers and comments for the exercises in C ++ primer 4th (Note: I didn't buy an answer book, so it is not guaranteed that it is correct. What do you think is wrong, I hope you can tell me) the requirements for source code running are the same as those in the book. The pre-compilation and using lines are omitted. If you still don't know what to say, you can ask me, but I am also a beginner and may not know, I know that I am a beginner when I am still studying C ++ Prime. You are welcome to repost it, but please keep the author's name "jiutian Yuling ". */
Typedef pair <string, int> sipair; // simplified definition method
Typedef vector <sipair> sidv;
Int main ()
{
String stra;
Int IA;
Sipair paira, pairb;
Sidv sidva;
While (CIN> stra> IA)
{
Paira. First = stra;
Paira. Second = IA; // method 1
Pairb = make_pair (stra, Ia); // method 2
Sipair pairc (paira );
Sipair paird (stra, Ia); // I do not know whether the above two calculation methods are counted. The original question requires three types.
// I think these methods have a better understanding, but the usage is a little different.
Sidva. push_back (paira );
}
For (sidv: iterator it = sidva. Begin (); it! = Sidva. End (); ++ it)
{
Cout <"the pair is :"
<It-> first <"" <it-> second <Endl;
}
Return 0;
}