我错在哪呢

xiaoxing2010 2010-03-14 11:24:48
# include <limits>
# include <iostream>
using std::cout;
using std::endl;
using std::numeric;
int main ()
{
cout<<endl
<<"max of doube is: "
<<numeric_limits<double>::max()
<<endl;
return 0;
}
老师,我编写了这段程序,但发现它在C++环境中运行不了,但我查了很多资料,却找不出其原因,你能给我的提示吗?以下是程序的错误地方
Compiling...
确定某类数型的极限.cpp
C:\Documents and Settings\吴小星\桌面\c++练习\确定某类数型的极限.cpp(9) : error C2065: 'numeric_limits' : undeclared identifier
C:\Documents and Settings\吴小星\桌面\c++练习\确定某类数型的极限.cpp(9) : error C2062: type 'double' unexpected
C:\Documents and Settings\吴小星\桌面\c++练习\确定某类数型的极限.cpp(9) : error C2039: 'max' : is not a member of '`global namespace''
Error executing cl.exe.
确定某类数型的极限.obj - 3 error(s), 0 warning(s)


...全文
119 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
因为Vc6是个SB,你不服都不行。用括号加个优先级就可以了。




int main ()
{
cout<<endl<<"max of doube is: "<<(numeric_limits<double>::max)()<<endl;
return 0;
}


参考:

http://www.jeffhung.net/blog/articles/jeffhung/626/
xiaoxing2010 2010-03-15
  • 打赏
  • 举报
回复
多谢各位的指教
某某9 2010-03-15
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 hairetz 的回复:]

因为Vc6是个SB,你不服都不行。用括号加个优先级就可以了。



C/C++ code

int main ()
{
cout<<endl<<"max of doube is: "<<(numeric_limits<double>::max)()<<endl;
return 0;
}
顶!

参考:

[url=http://www.jeffhung.net/blog/a……
[/Quote]
ypppla120 2010-03-15
  • 打赏
  • 举报
回复
学习了
cbajing 2010-03-15
  • 打赏
  • 举报
回复
建议楼主换个颜色.....
taodm 2010-03-15
  • 打赏
  • 举报
回复
珍惜生命,远离VC6
elegant87 2010-03-15
  • 打赏
  • 举报
回复
顶!学习了!
baihacker 2010-03-14
  • 打赏
  • 举报
回复
#include <limits>
#include <iostream>
using namespace std;
int main ()
{
cout<<endl<<"max of doube is: "<<numeric_limits<double>::max()<<endl;
return 0;
}
xiaoxing2010 2010-03-14
  • 打赏
  • 举报
回复
还是错啊
stardust20 2010-03-14
  • 打赏
  • 举报
回复
# include <limits>
# include <iostream>
using std::cout;
using std::endl;
using std::numeric_limits;//这边改下
int main ()
{
cout<<endl
<<"max of doube is: "
<<numeric_limits<double>::max()
<<endl;
return 0;
}

64,647

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧