#include<iostream> |
using namespace std; |
struct node |
{ |
int x,y; |
node ( int x=0, int y=0):x(x),y(y){} |
//重载输入输出,即cin>>node,cout<<node; |
friend ostream& operator << (ostream &out , const node &p) |
{ |
out<<p.x<< " " <<p.y<<endl; |
return out; |
} |
friend istream& operator >>(istream &in,node &p) |
{ |
in>>p.x>>p.y; |
return in; |
} |
//重载结构体比较用于 1.优先级队列 |
bool operator <( const node &p) const |
{ |
return x<p.x; |
} |
//重载结构体比较(两个参数) |
friend bool operator >( const node &a, const node &b) |
{ |
return a.x>b.x; |
} |
//重载结构体+,node=node_1+node_2 |
friend node operator + ( const node &a, const node &b) |
{ |
return node (a.x+b.x,a.y+b.y); |
} |
}; |
int main() |
{ |
return 0; |
} |