Answer the question
In order to leave comments, you need to log in
What's wrong with vectors?
Hey!
I'm studying C++ recently, I'm reading Stanley B. Lippman's book - "The C++ Programming Language. Basic Course". Here.
I have a few questions about vectors.
1) When I declare a vector and set the data explicitly, this is what I mean: vector<int> v{1, 2, 3, 4, 5};
The compiler throws an error.
1)expected primary-expression before "v"
2)expected `;' before "v"
2) When trying to access elements with an iterator, like this: auto iter = v.begin();
1)ISO C++ forbids declaration of `iter1' with no type
2) cannot convert `__gnu_cxx::__normal_iterator > >' to `int' in initialization
Again it throws an error.
What is the problem?
ps I'm using the DEV C++ program.
Answer the question
In order to leave comments, you need to log in
The compiler throws an error.
...
Again, it throws an error.
What is the problem?
The fact that you did not give us the text of the error.
At random, your compiler doesn't support C++0x
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question