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

Britta bought some carrots and apples for $24.80. A carrot and a apple cost $0.90 altogether. She bought more carrots than apples. The cost of the extra number
The most likely place to find fossils are in? A. The sap of ancient trees B. Volcanic rock C. Sedimentary rock
Zimbabwe was once a British colony called __________.
what was the interest rate in 1969
At the end of meiosis I, chromosomes in the two resultant cells are duplicated but not homologous true or false
What is the answer to 5 times 3/4
With what is Mary McLeod Bethune associated? She was lead prosecutor at the Nuremberg Trials. She was the first female advisor to President Roosevelt. She was t
what is the greatest factor of 52 that is a prime number?
how to turn 66 2/3% into a decimal then into a fraction
Which sentence does not contain any errors in capitalization? A. My cousins in Rhode island know how to speak hebrew. B. Did you realize that most of the actors