I have the following question dealingwith the vector class in C++ and just want
ID: 3609219 • Letter: I
Question
I have the following question dealingwith the vector class in C++ and just want to be sure that Iunderstand it correctly. Give the value of v.size() after executingeach of the following statements:vector<int> v(25);
v.push_back(-4);
v.resize(40);
m = v.back();
v.pop_back();
If I understand this correctly, v.size() should be asfollows after each respective statement is executed:
1) v.size() = 1
2) v.size() = 2
3) v.size() = 39
4) v.size() = 39
5) v.size() = 38
If I am incorrect, please help with an explanation. Thanks inadvance! I have the following question dealingwith the vector class in C++ and just want to be sure that Iunderstand it correctly. Give the value of v.size() after executingeach of the following statements:
vector<int> v(25);
v.push_back(-4);
v.resize(40);
m = v.back();
v.pop_back();
If I understand this correctly, v.size() should be asfollows after each respective statement is executed:
1) v.size() = 1
2) v.size() = 2
3) v.size() = 39
4) v.size() = 39
5) v.size() = 38
If I am incorrect, please help with an explanation. Thanks inadvance!