Oop3 BECTORS Flashcards

1
Q

What library is needed for vectors?

A

<vector>
</vector>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you declare vectors?

A

std::vector<dataType> foo(size);</dataType>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you declare vectors?

A

std::vector<type>foo(size);</type>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

.push_back();

A

Adds an element to the vector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to declare an iterator?

A

std::vector<int> myVector(10);

std::vector<int>::iterator iter = my vector.begin();</int></int>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you get the actual variable from the current iterator position?

A

Dereference it *iterator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to get the end iterator?

A

myVector.end();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly