Solution:
Welcome to the fun world of programming, mate.
There are a couple of ways to initialize a vector in c++. As far as the easiest way is your concern I recommend you to use this way below.
#include <bits/stdc++.h>
using namespace std;
int main()
{
// Create an empty vector
vector<int> vect;
vect.push_back(5);
vect.push_back(10);
vect.push_back(20);
for (int n : vect)
cout << n << " ";
return 0;
}
or,
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> vect{ 5, 10, 20 };
for (int n : vect)
cout << n << " ";
return 0;
}
In both cases, your output should be 5,10, and 20.