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 person has the most freedom to make his or her own lifestyle decisions? A -- Frieda is 10 years old and lives with her grandmother. B -- Vladimir is 3 yea
A machine can insert letters in envelopes at the rate of 120 per minute. Another machine can stamp the envelopes at the rate of 3 per second. How many such s
describe the battle of Vicksburg (briefly please)
what was the new racial order proposed by nazis
iambic pentameter is often used in? -plays -blank verse -prose -parliament
What does tanget mean in geometry?
Why does it take 10 copies of 1 sixth to make the same amount as five copies of 1 third explain your answer in words and pictures?
What is a preposition? a. A word that modifies a noun. b. A word that identifies a noun or noun phrase as definite or indefinite. c. A word that modifies a verb
assiduous : inattentive :: A. cordial : unsociable B. corporeal : incarnate C. dorsal : sedentary D. digital : technical E. sedentary : thoughtful
The _____ the frequency of a sound wave, the higher the pitch.