标签:stream cout names ace == algo scan cin fclose
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
struct Node{
int x,y;
}a[100];
int n;
//比较函数
int cmp(Node a,Node b){
if(a.x==b.x)return a.y<b.y;
return a.x<b.x;
}
void Scanf(){
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].x>>a[i].y;
}
}
void Print(){
for(int i=0;i<n;i++){
cout<<a[i].x<<" "<<a[i].y<<endl;
}
}
int main(){
// freopen("text1.txt","r",stdin);
Scanf();
sort(a,a+n,cmp);
Print();
// fclose(stdin);
return 0;
}
标签:stream cout names ace == algo scan cin fclose
原文地址:https://www.cnblogs.com/yifeianyi/p/12188687.html