弱弱的问题,关于algorithm库中max函数的使用
yxh02 2012-02-28 09:16:57 // max example
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
cout << "max(1,2)==" << max(1,2) << endl;
cout << "max(2,1)==" << max(2,1) << endl;
cout << "max('a','z')==" << max('a','z') << endl;
cout << "max(3.14,2.73)==" << max(3.14,2.73) << endl;
return 0;
}
出现如下错误信息:
error C2065: 'max' : undeclared identifier
这是cplusplus中的范例代码,为什么会出错呢?