You may have to use doskey_vector.push_back(x) instead.Code:doskey_vector.at(j) = x;
This is a discussion on I need help on C++ Uni Project within the C++ Programming forums, part of the General Programming Boards category; Code: doskey_vector.at(j) = x; You may have to use doskey_vector.push_back(x) instead....
You may have to use doskey_vector.push_back(x) instead.Code:doskey_vector.at(j) = x;
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
like this?Originally Posted by laserlight
I want to store the current value of variable x, to the vector. So every time the user types a command, the command will be stored, and the next one and so on...Code:doskey_vector.at(j) = doskey_vector.push_back(x);
Thank you
No, just use the push_back() member function.
You may want to read cppreference.com's article on vectors, and also check out SGI's Standard Template Library Programmer's Guide.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Like this:
Code:doskey_vector.push_back(x);
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.