首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

题,关于algorithm库中max函数的使用

2012-03-18 
弱弱的问题,关于algorithm库中max函数的使用// max example#include iostream#include algorithmusing

弱弱的问题,关于algorithm库中max函数的使用
// 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中的范例代码,为什么会出错呢?

[解决办法]
你用什么编译器搞得?VS 2005没错
[解决办法]
看看math.h以及stdlib.h这两个头文件是否提供了max函数吧
[解决办法]
vs 2008也没错
[解决办法]

探讨
vc++6.0中出现这种情况怎么办呢?要不要安装什么插件?

热点排行