在code::blocks中运行没错,可在VC++6.0中有错误!

勇敢的搬砖人 2010-02-04 03:42:36
/*下面程序为什么在code::blocks中运行没错,可在VC++6.0中有错误:


--------------------Configuration: 正号形式输出 - Win32 Debug--------------------
Compiling...
正号形式输出.cpp
c:\documents and settings\administrator\桌面\正号形式输出.cpp(8) : error C2872: 'cout' : ambiguous symbol
c:\documents and settings\administrator\桌面\正号形式输出.cpp(9) : error C2872: 'cout' : ambiguous symbol
执行 cl.exe 时出错.


*/
#include<iostream>
#include<iomanip.h>

using namespace std;

int main()
{
cout<<10<<" "<<-20<<endl;
cout<<setiosflags(ios::showpos)<<30<<" "<<-40<<endl;

return 0;
}
...全文
143 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
nightload 2010-02-05
  • 打赏
  • 举报
回复
VC++6.0 中还是带.h吧。不然会有错吧。标准问题。很多人说要 真爱生命,远离VC6.0 估计就是说它的标准太老了。。。。
WPooh 2010-02-04
  • 打赏
  • 举报
回复
将#include <iomanip.h>改成#include <iomanip>。
cocat 2010-02-04
  • 打赏
  • 举报
回复

#include <iostream>
#include <iomanip>//楼主你别再看那个书啦,把这个头文件改改,XXX.h已经是旧的形式了

using namespace std;

int main()
{
cout <<10 <<" " <<-20 <<endl;
cout <<setiosflags(ios::showpos)<<30<<" "<<-40<<endl;

return 0;
}
healer_kx 2010-02-04
  • 打赏
  • 举报
回复
#include <iomanip>
yzx714 2010-02-04
  • 打赏
  • 举报
回复
VC6就这样
stardust20 2010-02-04
  • 打赏
  • 举报
回复
#include <iostream> 
#include <iomanip> //这边没有.h

using namespace std;

int main()
{
cout <<10 <<" " <<-20 <<endl;
cout <<setiosflags(ios::showpos) <<30 <<" " <<-40 <<endl;

return 0;
}

64,643

社区成员

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

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