//#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;