string str="bobo";
cout<<str;
系统提示:
D:\myproject\enum\enum.cpp(54) : error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class ostream_withassign' (or there is no acceptable conversion)
Error executing cl.exe.
么回事呢?
cout<<str;
系统提示:
D:\myproject\enum\enum.cpp(54) : error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class ostream_withassign' (or there is no acceptable conversion)
Error executing cl.exe.
么回事呢?
解决方案 »
- CRichEditCtrl里无窗口的控件怎么添加窗口提示?
- 程序员们最快成为百万富翁的方法
- CListCtrl控件的一个小问题~
- 请问高手CListCtrl 和 CImageList 都是列表控件吧?有啥区别?
- 广州一上机面试题,自动抓取网页. 高手帮下?
- [求]陈建春的矢量图形系统开发与编程电子书
- VC里面有没有计时的函数
- 有关进度条的问题,大家来看一看!!
- 如何编写dll函数使之能被阻塞调用?
- 关于县城优先级的问题
- 请问:当网络不通时(可以不是拔掉网线),而socket再没接到返回报告时,还是在发送(这不就不对了嘛)。所以服务器端要马上知道网络不通
- 关于memcpy()等内存操作函数的问题,请帮忙
char *p = (char*)str.c_str();//转换一下类型
basic_ostream& operator<<(basic_ios<E, T>& (*pf)(basic_ios<E, T>&));
basic_ostream& operator<<(ios_base<E, T>& (*pf)(ios_base<E, T>&));
basic_ostream& operator<<(basic_streambuf<E, T> *sb);
basic_ostream& operator<<(const char *s);
basic_ostream& operator<<(char c);
basic_ostream& operator<<(bool n);
basic_ostream& operator<<(short n);
basic_ostream& operator<<(unsigned short n);
basic_ostream& operator<<(int n);
basic_ostream& operator<<(unsigned int n);
basic_ostream& operator<<(long n);
basic_ostream& operator<<(unsigned long n);
basic_ostream& operator<<(float n);
basic_ostream& operator<<(double n);
basic_ostream& operator<<(long double n);
basic_ostream& operator<<(void * n);
//--------------------------------------------------------
怎么会不支持??
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
string s("hehe");
cout << s << endl;
return 0;
}
#include <string>
using namespace std;
void main()
{
string s="Do you understand??";
cout << s ;
}
getline( cin, x );
<string> Members | string::getline Sample
Extract strings from the input stream line-by-line.template<class CharType, class Traits, class Allocator>
basic_istream<CharType, Traits>& getline(
basic_istream<CharType, Traits>& _Istr,
basic_string<CharType, Traits, Allocator>& _Str
);template<class CharType, class Traits, class Allocator>
basic_istream<CharType, Traits>& getline(
basic_istream<CharType, Traits>& _Istr,
basic_string<CharType, Traits, Allocator>& _Str,
CharType _Delim
);
Parameter
_Istr
The input stream from which a string is to be extracted.
_Str
The string into which are read the characters from the input stream.
_Delim
The line delimiter.
Return Value
The first function returns getline( _Istr, _Str, _Istr.widen( '\n' ) ). The second function replaces the sequence controlled by _Str with a sequence of elements extracted from the stream _Istr. Res
In order of testing, extraction stops: At end of file.
After the function extracts an element that compares equal to delim, in which case the element is neither put back nor appended to the controlled sequence.
After the function extracts str.max_size elements, in which case the function calls setstate(ios_base::failbit).
If the function extracts no elements, it calls setstate(failbit). In any case, it returns _Istr.See Also
<string> Members | string::getline Sample--------------------------------------------------------------------------------Send feedback on this topic to Microsoft© 1992-2002 by P. J. Plauger. All rights reserved.© Microsoft Corporation. All rights reserved.
#include <iostream>
#include <string>