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

on the following checking account record into the figures and add or subtract them to keep the running total correct
A meiotic division produces____daughtercells
In the process of photosynthesis chlorophyll serves as
Which of the following items describe the effects of an entrepreneur's actions? Select all that apply. creating new jobs inventing a new product opening a new s
Hello everyone can you check my hm number 3,4,6,10,12 thank you :)
A 6-pack carton of sport drink bottles at the local grocery store is labeled an 13.48 oz. what is the weight of the carton rounded to the nearest tenth of an ou
What is a drawback of a member of Congress voting as a partisan
Find the measure of ∠B.
Complete the work to simplify the expression (–2d5)4.   1. Express 4 factors of –2d5:     (–2d5)(–2d5)(–2d5)(–2d5) 2. Expand the expression:        –2 ∙ –2 ∙ –2
Solve for x. -2(5x+4)-3x+3=-18