1#include <iostream>
2#include <vector>
3using namespace std;
4
5// program to illustrate use of std::vector::assign()
6
7int main()
8{
9 int vec_size, new_val;
10 cin >> vec_size >> new_val;
11 vector<int> vec(vec_size);
12
13 for (int x : vec)
14 cout << x << " ";
15
16 cout << endl;
17
18 // vec.assign(n, val) assigns all n elements of vec new value = val
19 vec.assign(vec_size, new_val);
20 for (int x : vec)
21 cout << x << " ";
22}