1.结构体初始函数格式:
struct Edge{
int from,to,cap,flow;
Edge(int u,int v,int c,int f)
:from(u),to(v),cap(c),flow(f){};
};
相当于
struct Edge{
int from,to,cap,flow;
Edge(int u,int v,int c,int f)
{
from=u;
to=v;
cap=c;
flow=f;
}
};
也可写为
struct Edge{
int from,to,cap,flow;
Edge(int u,int v,int c,int f)
{
this->from=u;//相当于(*this).from
this->to=v;
this->cap=c;
this->flow=f;
}
};