结构体相关

来源:互联网 发布:网络运营商怎么设置 编辑:程序博客网 时间:2024/06/06 06:36

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;    } };
原创粉丝点击