1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Advocard [28]
3 years ago
12

Modify the existing vector's contents, by erasing the element at index 1 (initially 200), then inserting 100 and 102 in the show

n locations. use vector adt's erase() and insert() only, and remember that the first argument of those functions is special, involving an iterator and not just an integer. sample output of below program:
Biology
1 answer:
Aleonysh [2.5K]3 years ago
7 0

Answer:

Following are the code to this question:

#include <iostream>//defining header file

#include <vector>//defining header file

using namespace std;

void PrintVectors(vector<int> numsList)//defining a method PrintVectors that accept an array

{

   int j;//defining integer variable

   for (j = 0; j < numsList.size(); ++j)//defining for loop for print array value  

   {

       cout << numsList.at(j) << " ";//print array

   }

   cout << endl;

}

int main()//defining main method  

{

   vector<int> numsList;//defining array numsList

   numsList.push_back(101);//use push_back method to insert value in array

   numsList.push_back(200);//use push_back method to insert value in array

   numsList.push_back(103);//use push_back method to insert value in array

   numsList.erase(numsList.begin()+1);//use erase method to remove value from array

   numsList.insert(numsList.begin(), 100);//use insert method to add value in array

   numsList.insert(numsList.begin()+2, 102);//use insert method to add value in array

   PrintVectors(numsList);//use PrintVectors method print array value

   return 0;

}

Output:

100 101 102 103  

Explanation:

In the above-given code, inside the main method an integer array "numList" is defined, that use insert method to insert value and use the erase method to remove value from the array and at the last "PrintVectors" method is called that accepts a "numList" in its parameter. In the "PrintVectors" method, a for loop is declared, that prints the array values.

You might be interested in
A kitten might have genes for poor vision, but it could learn to...
vova2212 [387]
Whats the question in this?
7 0
3 years ago
Read 2 more answers
A patient with sneezing, congestion, fever, and a cough visits the doctor and asks for an antibiotic as treatment. Which of the
Allisa [31]
A. Because the symptoms will become worse and the patient obviously does not want it to continue into s more difficult virus
4 0
3 years ago
Read 2 more answers
How does the molecular clock work?A. It analyzes the brain functionality of two different species.B. It examines and compares th
Eva8 [605]

you could've just searched online but d

7 0
3 years ago
Read 2 more answers
• What makes animals and plants different<br> in form and function?
Pavel [41]

Answer:

Plants take up nutrients in water and make their own food. Animals ingest/  eat food and cannot make food. Animals have soft membranes and have skeletons to give body shape

Explanation:

3 0
3 years ago
Read 2 more answers
which principles states, that in undisturbed rock layers, the oldest rocks are on the bottom and the youngest rocks are on top
Leviafan [203]

Answer:

The correct answer is principle of superimposition.

Explanation:

According to the superimposition principle, in the undisturbed rocks, the youngest rocks are situated on the top and the oldest rocks are found in the bottom. The phenomenon takes place due to withering. The rocks get withered because of the influence of air and water.  

The soil particles or the sediments get gathered at another site. The deposits of sediments get concentrated with time and result in the production of rocks. The mature rocks get surrounded by the layers of sediments with time passing by. These sediments get concentrated again to produce novel rocks. Through this procedure, the fresh young rocks get produced over the older ones.  

3 0
3 years ago
Other questions:
  • Nucleotides in dna are made of three basic components: a sugar called
    13·1 answer
  • Explain the difference between the good we eat and energy in the body
    14·1 answer
  • What occurs during metaphase 1 of meiosis?
    8·1 answer
  • Discuss the potential effect on the biosphere if diatoms were prevented from storing their food as oil.
    5·1 answer
  • A glucose molecule is to starch as _____.
    14·1 answer
  • Can somebody sort these correctly? 6/10 are correct! Mitosis vs Meiosis
    11·1 answer
  • What is the best defenition of bias
    9·1 answer
  • (30 words) Summary: How can someone identify characteristics of living things
    5·1 answer
  • Which of these is an individual effort for saving a habitat? Select all that apply.
    9·1 answer
  • A skeleton muscle is a composition of several components bundled one into the other.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!