Learn
Vectors
Introduction to Vectors
To do just about anything of interest in a program, we need a group of data to work with.
For example, our program might need:
- A list of Twitter’s trending tags
- A set of payment options for a car
- A catalog of eBooks read over the last year
The need for storing a collection of data is endless.
We are familiar with data types like int
and double
, but how do we store a group of int
s or a group of double
s?
In this lesson, we will start with one of the simplest, and arguably the most useful, ways of storing data in C++: a vector.
A vector is a sequence of elements that you can access by index.
Instructions
Click Next to continue.