这段代码有问题吗?为什么8warnings?

vn68214 2007-04-14 09:13:44
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
int main()
{
istream_iterator<string> is(cin);
istream_iterator<string> eof;
vector<string> text;
copy(is, eof, back_inserter(text));
sort(text.begin(), text.end());

ostream_iterator<string> os(cout, “ ”);
copy(text.begin(), text.end(), os);
return 0;
}
...全文
190 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
vn68214 2007-04-14
  • 打赏
  • 举报
回复
谢谢啦,我发现在生成debug版本的exe时会有问题,而release不会
loongee 2007-04-14
  • 打赏
  • 举报
回复
除了那两个双引号是中文的会报错外,没有其他警告

我用的是DEV C++ 4.9.9.2
hellox 2007-04-14
  • 打赏
  • 举报
回复
又是vc6,呵呵..

hellox 2007-04-14
  • 打赏
  • 举报
回复
ostream_iterator<string> os(cout, “ ”);
=======================
ostream_iterator<string> os(cout, " ");
代码没问题的,在vs2005下无warnings
vn68214 2007-04-14
  • 打赏
  • 举报
回复
vc6
taodm 2007-04-14
  • 打赏
  • 举报
回复
什么编译器,什么warning?

65,212

社区成员

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

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