我试图输入数据作为整数对的列表,按第一对值排序对,然后是第二个值,然后输出排序的对值;
#include <list>
#include <iostream>
#include <algorithm>
//experiment with list sort of pair
using namespace std;
int main (int argc, char* argv[]){
    int N,x,y;
    list< pair<int,int> >::iterator it;
    list< pair<int,int> > a; 
    cout<<" number of pairs?"<<endl;
    cin >> N;
    cout<<"enter pairs, with space between 1st and second of pair"<<endl;
    for(int i=0;i<N;++i) {
        cin >> x >> y;
        a.push_back(make_pair(x,y)); 
    }
    cout<<"sorted pairs;"<<endl;
    sort(a.begin(),a.end()); // Sorts first the x, then the y-coordinate
    for (it=a.begin(); it!=a.end(); ++it) {
        cout << " " << …