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

1. What are the some effects of dietary related health conditions on an individual?
Which of the following 1/6 is closest to? 1/2 1 0
What are the redundant Words and Phrases in these sentences? 1. Right now, I am currently contemplating if I have enough time to take a nap before I start my
The Senate and the House of Representatives can override the President's veto by blank vote A majority B 3/4 C 3/5 D 2/3
Which do you think had a greater impact on world history - the Industrial Revolution or the Rise of Nationalism?
please help me please will give brainliest to please write the words used in this box​
Help help please......
16. Which type of sediments would be most common where a river meets an ocean?
Which of the following is an example of a chemical change? AnswersA. Boiling waterB. Burning paper C. Dissolving sugar in water D. Melting gold​
PLEASE HELP!! what is true about the graph of the line y= -3x + 4? a) the line has a slope of 4 b) the line has a slope of -4 c) the line crosses the y-axis bel