Vector Declaration
Before we can work with a vector, we must first declare it. Vector declaration has the following form:
std::vector<type> name;Where:
typeis the data type of values the vector will contain (e.g., int, double, string)nameis the name of the vector we choose
Declaration examples:
std::vector<int> numbers; // Vector for integers
std::vector<double> temperatures; // Vector for decimal numbers
std::vector<std::string> names; // Vector for textsDon't forget that to use vectors we must include at the beginning of the program:
#include <vector>And for working with text (string):
#include <string>Instructions
Declare a vector of integers (int) with the name scores.
Start programming for free
2/10