C++编译错误,竟然说函数未定义??

程序是这样的:

#include

#include

using namespace std;

class node

{

public:

int height;

int x,y;

};

bool less(const node& a, const node& b)

{

return a.height > b.height;

}

int main()

{

int n;

...

node *list = new node[n];

...

sort(list,list+n,less);

}

结果如此:

编译失败...|错误号:1

MyProger\Prog12932.cpp: In function int main()':
MyProger\Prog12932.cpp:41: error:
less' undeclared (first use this

function)

MyProger\Prog12932.cpp:41: error: (Each undeclared identifier is

reported only once for each function it appears in.)

未啥啊?我在VC上没问题

0 条评论

目前还没有评论...

信息

ID
1011
难度
6
分类
动态规划 点击显示
标签
递交数
10333
已通过
2937
通过率
28%
被复制
23
上传者