#include "stdafx.h"
#include <iostream>
#include <iterator>
#include <string>
using namespace std ;void main()
{
string str("Hello World");
cout<< str << endl;
str.assign( istream_iterator<char>(cin), istream_iterator<char>() ); cout << str << endl;}F:\test\test.cpp(38) : error C2664: 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &__thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(const char *,unsigned
int)' : cannot convert parameter 1 from 'class std::istream_iterator<char,char,struct std::char_traits<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.test.exe - 1 error(s), 0 warning(s)
这是我下的一个关于string的资料里面的程序,想问问哪出错误 ?
解决方案 »
- Borland C++ Linking 问题,求大神解救!
- 怎样使同一窗口只打开一次,且内容已经更新
- 请帮我看一下我的代码有什么问题,文件打开对话框,可是程序有时会突然退出
- 请教:如何使用OpenGL绘制三维纹理?所需显卡?
- 求教高手,怎样完成这个程序
- 俄罗斯方块问题,请教大家
- 求在动态链接库下把调用这个动态链接库的进程删掉的函数!!
- 这两个头文件有什么区别?
- 求 邮件服务器的开发思想
- 求问如何查看一个MFC文件共链接了多少个源文件
- 在通信中,以固定数组做为整体传送.比如定义了 char strMSG[200];当其中字符不足200时,如里边内容为:"abc",请问发送的时候是发送4个字节还是200个字节?
- 寻求codeproject上绘制网络拓扑图的文章
你可以试试2003或者以上的版本。
ctrl+z后可以正常分配新的字符串给string