#include <iostream>
#include <vector>
using namespace std;
int main() {
// initializer list
vector<int> vect = {1, 2, 3, 4, 5};
cout << "vector = ";
// ranged loop
for (const int& i : vect) {
cout << i << " ";
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main() {
// uniform initialization
vector<int> vect{1, 2, 3, 4, 5};
cout << "vector = ";
// ranged loop
for (const int& i : vect) {
cout << i << " ";
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main() {
// method 3
vector<int> vect(5, 10);
cout << "vector = ";
// ranged loop
for (const int& i : vect) {
cout << i << " ";
}
return 0;
}