C++ vector<string>读入数据及读取问题
#include<iostream>usingnamespacestd;#include<vector>intmain(){//stringstr[4]={"啊啊","西...
#include <iostream>
using namespace std;
#include <vector>
int main()
{
//string str[4]={"啊啊","西西","哇哇","哈哈"};
vector <string> vstr(str,str+4);
vector<string>::iterator it;
for( it= vstr.begin() ; it !=vstr.end() ; ++it)
cout << *it << endl;//error
return 0;
}
VC中错误提示为:
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 acceptable conversion)
怎么才能读取出数据啊,去掉*后,读出的是地址额 展开
using namespace std;
#include <vector>
int main()
{
//string str[4]={"啊啊","西西","哇哇","哈哈"};
vector <string> vstr(str,str+4);
vector<string>::iterator it;
for( it= vstr.begin() ; it !=vstr.end() ; ++it)
cout << *it << endl;//error
return 0;
}
VC中错误提示为:
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 acceptable conversion)
怎么才能读取出数据啊,去掉*后,读出的是地址额 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询