std::set容器,vc++支持吗??

shoot 2001-11-05 05:30:52
下边程序在VC++下编译错误,这可是买书时候带的盘上的例题,请高手们帮帮我

#include <iostream>
#include <set>

int main()
{
// Create the set object.
std::set<int> intSet;

// Populate the set with values.
intSet.insert(10);
intSet.insert(5);
intSet.insert(1);
intSet.insert(3);
intSet.insert(8);

// Display the contents of the set.
std::cout << "Contents of set: " << std::endl;
set<int>::iterator iter;
for (iter=intSet.begin(); iter!=intSet.end(); iter++)
std::cout << *iter << std::endl;

return 0;
}
...全文
92 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
richielee 2001-11-05
  • 打赏
  • 举报
回复
// Display the contents of the set.
std::cout << "Contents of set: " << std::endl;
set<int>::iterator iter;
~~~
这里少了std::
bdsc 2001-11-05
  • 打赏
  • 举报
回复
加上using namespace std; 试试

69,368

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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