Does any one know how to display a vector after inputing numbers into the vector? Help

Printable View

- 09-04-2001tony1displaying a vector
Does any one know how to display a vector after inputing numbers into the vector? Help

- 09-04-2001zen
Do you mean STL vector? If so you can access the vector the same way as an array, using the subscript operators -

vector <int> yourVector(300);

yourVector[0]=10;

cout << yourVector[0];

//etc - 09-06-2001edk
if it's a vector like a resizeable array, here's what you do.

Code:`for (int i(0); i < yourVector.size(); i++){`

cout<<yourVector[i]<<"\n";

}