最佳答案
为什么我不能像这样 cout
string
:
string text ;
text = WordList[i].substr(0,20) ;
cout << "String is : " << text << endl ;
执行此操作时,会得到以下错误:
错误2错误 C2679: 二进制’< <’: 没有找到操作符,该操作符采用类型为‘ std: : string’的右边操作数(或者没有可接受的转换) c: users mollasadra document Visual Studio 2008 project barnamec barnamec barnamec.cpp 67 barnamec * *
令人惊讶的是,即使这样也不管用:
string text ;
text = "hello" ;
cout << "String is : " << text << endl ;