string问题
程序源码:#include <iostream>
#include <cstring>
using namespace std;
int main()
{
string strinfo="please input a string:\n";
cout<<strinfo;
cin>>strinfo;
cout<<strinfo;
return 0;
}
运行时报错了:
d:\vc++ 6.0\msdev98\myprojects\ycp\a.cpp(8) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptabl
e conversion)
不知道为什么?