0% found this document useful (0 votes)
199 views1 page

Assignment Problems: Vectors in C++

A PDF that gives you basic outline of what you can do with vectors in C++. It includes inputs, outputs and ways to manage data in a vector.

Uploaded by

Emperor Saladin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
199 views1 page

Assignment Problems: Vectors in C++

A PDF that gives you basic outline of what you can do with vectors in C++. It includes inputs, outputs and ways to manage data in a vector.

Uploaded by

Emperor Saladin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Make a greater than operator

Assignment Problems
A dynamic array, that you can add and remove entries from A type of container

Use unsigned int because v1.size() returns unsigned int. Iterator is a pointer Vector<thing>::iterator it; Acts like an array vector[5]; vector[5] = 10;

What is it? Iteration

Cheap adding at the end

Vectors in C++

Memory

Adding too much can become slow Needs to copy data to another place

Will throw exception


vector.at(); front(); back(); Resize push_back pop_back Add Memory Add/Remove Element Safer Access

Data Modification Declaration and Initialization


vector<type> varName ( initialSize , initialValue ); Good to keep initial value

You might also like