c++中定义结构体

struct Node{
    int k;
    int to;
    int cost;
    Node(int to, int k,int costt=0.0): k(k), to(to), cost(costt){ }   //带有默认参数的变量需要放在后面

    Node(){

    }
};

Node node = Node(); //没有new

猜你喜欢

转载自blog.csdn.net/qq_41698081/article/details/91126331