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

Find the distance between y=-x and y=-x-4.
who created the camera
Which of the following adaptations to life on land is found in both insects and modern reptiles? A. ability to fly B. tracheae to distribute oxygen C. two
What is the perimeter of 2m 10cm by 45cm
what has shaped much of a landscape along the North European Plain
RS=8y+4,ST=4y+8,andRT=15y-9 What is the value of y Find RS,ST,and RT
The sum of the measures of angle x and y is 90. If the measures of angle x is 30 less than twice the measures of angle y what is the measure of angle x?
a shelf is in the shape of a triangle. find the angles of the triangle if the measures of the angles are in the ratio x:x:4x.
What is the plural form of the word chimney
What is the standard form of the equation? 3x = 2y – 4 A. 3x = 2y – 4 B. 3x – 2y = –4 C. 3x + 4 = 2y D. 3x – 2y + 4 = 0