cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Defining vector size
Defining vector size
Dec 31, 2008 at 10:17am UTC
Naomi32
(1)
I cannot work out how I can create a vector such, that the user has to enter the length of that vector...
Thanks for helping!
Dec 31, 2008 at 12:24pm UTC
Repentinus
(31)
Ask the size from a user, store it in variable
n
and then do
vector <whatEverTypeYouNeed> yourVectorName(n);
Dec 31, 2008 at 12:31pm UTC
Bazzy
(6281)
Use the resize function
http://www.cplusplus.com/reference/stl/vector/resize.html
Topic archived. No new replies allowed.