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
WARM-UP
Naddik [55]
It’s burning wood ,heating water,Roasting food
3 0
3 years ago
Which scenario describes a way that an abiotic factor can impact a marine system? Liquid water turning into solid ice encourages
Sloan [31]

Answer:

Rapid increases in water temperature cause extensive fish kills

Explanation:

Biotic factors are all living organisms that contribute to an ecosystem. On the other hand, abiotic factors are non-living factors, such as climatic factors (temperature, rainfall, wind), edaphic factors (soil type, soil texture, soil aeration etc). Changes of abiotic factors can have a huge influence on living organisms of ecosystem. The effects might be benefical or harmful.

Some of the most common abiotic factors that can impact a marine ecosystem are water temperature, currents, light, alkalinity, oxygent concentration etc.

4 0
3 years ago
What does the cell nucleus contain?
Ulleksa [173]

A nucleus cell contains chromosomes among other things.

6 0
2 years ago
How does coastal erosion shape Florida?
kow [346]
Answer: B costal erosion causes the beach to wear away
4 0
3 years ago
Answer the question !!! What improvements could I make if I wanted to have a better controlled experiment ? And think about some
iris [78.8K]
You could have made sure the books were the same weight and your friends could have done it at the same time as you
3 0
3 years ago
Other questions:
  • This is the process in which water moves through a membrane, from an area of high concentration to an area of lower concentratio
    13·2 answers
  • Elijah wanted to learn more about the growth pattern of bacteria, so he performed the following experiment.
    14·1 answer
  • The theory of endosymbiosis claims that millions of years ago, aerobic bacteria were taken inside of anaerobic cells through end
    11·2 answers
  • Vitamins and minerals keep the blood healthy. Which part of the blood carries minerals, vitamins, and other nutrients to the bod
    7·1 answer
  • Which of the following organelles can be best be compared to a conveyer belt
    11·2 answers
  • Michael decides to bake bread one morning. He measures ingredients, mixes them together to make dough, and cooks the dough in an
    15·1 answer
  • Identify the main role of mitochondria in animal cells.
    13·1 answer
  • Question 8(Multiple Choice Worth 1 points) (01.02 LC)What should you do if you see lightning while you are outside exercising? H
    13·1 answer
  • An example of __ is the color of betta fish. When a RED fish (GG) is crossed with a YELLOW fish (gg), all of the offspring will
    14·1 answer
  • A student wrote the following observations in a field notebook: two grey wolves, five moose, several species of conifer trees, l
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!