请高人指点如何编译通过这个 C++ 程序
程序员长弓 2007-04-17 09:30:21 怎么解决下面程序在VC 6.0中的编译错误,请高人指点迷津!!!!!!!
#include<iostream.h>
#include<string>
#include<vector>
using namespace std;
void mian()
{
string word;
vector<string> text;
while(cin>>word)
text.push_back(word);
cout<<"Words read are: \n";
for(vector<string>::iterator it=text.begin();
it!=text.end();++it)
cout<<*it<<' ';
cout<<endl;
}
编译错误如下所示:
D:\test\test.cpp(11) : 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)
D:\test\test.cpp(11) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
test.obj - 2 error(s), 0 warning(s)