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

Which Enlightenment philosopher believed in equality for all people, especially the common man? Voltaire Locke Montesquieu Rousseau
Can someone please help me figure out what’s 18 3/4 as a decimal
What reflection can I write with the phrase better poor with good health than rich with a sick body
Write a program to construct the first 15 terms of a geometric sequence with initial term 4 and a common ratio 1/2. The output should be a python list and the n
Part C Next, you should make an outline for your persuasive essay about which character faces the most difficult conflict. Remember that an outline organizes yo
HELPPP FOR BRAINLEST!!! RIGHT NOW PLEASE
For this sequence describe (in words) a way to produce each new term from the previous term.
hi i will give a lot of points please help tho
how does the housefly stage affect the other​
Create a data set that contains 10 values such that the mean is greater than the median.