TestView0 2013-06-19 09:03 采纳率: 50%
浏览 1908
已采纳

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.

  • 写回答

4条回答 默认 最新

  • skatysky 2013-06-19 13:43
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献