C++ 新手求解。。。。。

//#include
#include

using namespace std;

#include

void main()
{
string str1 = "Eventually I stopped caring...";
string str2 = "but that was the '80s so nobody noticed.";

str1.append( str2, 25, 15 );
cout << "str1 is " << str1 << endl; 

}

F:\C text\t.cpp(13) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptable conversion)
Error executing cl.exe.

你这样写,需要加命名空间,在程序开头写using namespace std;
如果你不加这句,你要输出语句就得这么写:std::cout<<"str is"<<str1<<endl;

用的编译器或者库的版本有点低吧,试试改成:
cout << string("str1 is ") << str1 << endl;

cout << string("str1 is ") << str1 << endl;肯定可以

需要包含#include 这个头文件吧