Join Peggy Fisher for an in-depth discussion in this video Vectors, part of Up and Running with C++.
…One of the big limitations of arrays is that they are a fixed size.…While C++ offers another data type that is like an array, it's called a vector.…It holds a list of values or elements.…If you're familiar with Java, vectors are very similar…to array lists, but the advantage to a vector…is it's not a fixed size, and the values…can be added and it will automatically increase in size.…To use a vector, we add the vector directive.…When creating vectors, we can create vectors that are empty.…We can create vectors that have an initial size.…We can also create vectors that have an initial…size and initial value for each element in the vector.…We access vectors just like we do with the rays.…We use subscripts.…Let's take a look at my example here.…I'm creating three vectors.…The first one is an empty vector, and it contains car VIN numbers.…The second vector is an integer vector that contains ten random numbers.…The third vector holds prices for five items that are initially set to zero.…To make our program more flexible, I'm going to define a variable called numCars,…
- Downloading and exploring the C++ IDE
- Working with loops
- Using predefined functions
- Creating custom functions
- Creating and instantiating classes
- Working with external files
Skill Level Beginner
1. Getting Started
2. C++ Basics
3. Flow of Control
4. Classes and Objects
5. Data Structures
6. File Manipulation
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.