
#include
void main()
{using namespace std;
vector
#include
#include
void main()
{using std::vector;
vector
C:\Documents and Settings\Administrator\Cpp2.cpp(11) : error C2653: 'vector
C:\Documents and Settings\Administrator\Cpp2.cpp(11) : error C2065: 'size_type' : undeclared identifier
新手上入,求指导。。。
是啊。。那本书是C++PRIMER应该不会错。。我觉得是我弄错了,你用的是什么编译器?
还有顺便问下:输出定义了vector
void main()
{
using std::vector;
using std::cin;
using std::endl;
using std::cout;
using std::string;
vector
string word;
while(cin>>word)
text.push_back(word);
cout<
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::vector
>,class std::allocator
你用的什么编凯氏译器?在VS2010上简滑,我用两种方式都成功了。
关于你补充的问题。是由于cout的<<操作符无法输出vector
想要输出,只能遍历容器中的内容。
for (vector
{
cout<盯咐散<*beg<
using std::vector;这种使用方法没错的。我试过了,除了一个警告,没有error。