lambogarcia3 lambogarcia3
  • 15-05-2021
  • Computers and Technology
contestada

Assume you define a vector in the following way:

vector vec;

Assign the value 10 to the first element of this vector. What is the statement you would use?

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 20-05-2021

Answer:

vec[0].push_back(10)

Explanation:

Given

Declaration: vector <int> vec

Required

Assign 10 to the first element

This can be done using the push_back keyword.

The syntax is:     vectorname[position].push_back(value);

In this case:

vectorname = vec

position = 0 i.e. first element

value = 10

So, we have:

vec[0].push_back(10)

Answer Link

Otras preguntas

true or false the democratic republicans favored a STRICT interpretation into the constitution
What division problem is modeled?
Which rule was used to create the input/output?
-2,75 is greater or less than -2.5
Find the equation of the line that is parallel to 4y-x=3 and passes through the point (8,-7)
would my 82% change if i got a 52% on my exam
my mom gave me 5 dollar and I had 6 dollar and my dad gave me 8 dollar how much money I have?/
-6+ (-19) = Evaluate
5x + y = 11 3x − y = 9
What is x, the distance between points S' and S? x = 2.25 units x = 2.5 units x = 4.25 units x = 4.5 units