{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

12 Vectors and Vectors of Vectors, oh my!

# 12 Vectors and Vectors of Vectors, oh my! - Engineering101...

This preview shows pages 1–8. Sign up to view the full content.

Click to edit Master subtitle style Engineering 101 Vectors and Vectors of Vectors, oh my!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Quote of the Day The High Life From building cars, planes, and trains To building drugs, plugs, and cranes, We exist on the fundamentals through struggle and pain, Doing math and science to help the world have less strain. With our video games and quirky jokes, All of us unite in someway until we croak. Our actions, though they cause some to jeer, Allow us to proudly say, “I am an engineer!” - Tejash Patel, ENGR 101 (W’09)
Making Lists of Things n Often times we want to make lists of things  that are not characters n For these we can use another class called the  vector  class #include <vector>

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Vectors n Vectors can be used to make lists of anything:  int, double, char, string, …. n To declare a vector you have to specify the  type you are making a list of. vector <type> identifier;
Vectors n For example: vector <int> intlist; vector <double> doublelist; vector <string> stringlist;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Vectors n Typically we also want to tell how long this list  will be: vector <int> intlist(5); vector <double> doublelist(10); vector <string> stringlist(25);
Vectors n We can also specify what to initialize the  values in the list to: vector <int> intlist(5, -1); vector <double> doublelist(10, 0.0); vector <string> stringlist(25, “none”);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 29

12 Vectors and Vectors of Vectors, oh my! - Engineering101...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online