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
At what time of the year are most of the animals living in a temperate grassland likely to reproduce?
kramer
<span>A In spring and summer to coincide with the growing season

</span>
8 0
3 years ago
If a person is injured and has type AB blood, what type(s) of blood would the doctor be able to give
MissTica
The doctors would be able to give Type A, Type B, Type O and Type AB
7 0
3 years ago
Read 2 more answers
Lesson 3.2 It’s in the Genes
egoroff_w [7]

Answer:

What's your question?? sorry

8 0
3 years ago
During diffusion, molecules move
skad [1K]
Yes i bleve that during diffsion molicules move.

4 0
3 years ago
Read 2 more answers
What were the four examples of autotrophic organisms?
Degger [83]

Answer:

Plants, coral, bacteria, and algae do this. Bacteria is a more recent find in the process of photosynthesis with primary producers, as they were just discovered in the soil. During photosynthesis, primary producers take energy from the sun and produce it into energy, sugar, and oxygen.

Explanation:

Hope it helps

7 0
2 years ago
Other questions:
  • Which series lists the structural components of the light dependent reactions in order from smallest to largest
    9·2 answers
  • If we know that apatite is the mineral that makes up the enamel of our teeth, what physical properties might you want to know ab
    8·1 answer
  • Which organisms perform cellular respiration?
    8·1 answer
  • Where do the electrons needed by photosystem ii originate?
    12·1 answer
  • What biological macromolecule is made up of monomers like the one shown below?
    13·2 answers
  • In a certain species of plant, flowers occur in three colors: blue, pink, and white. A pure-breeding pink plant is mated with a
    14·1 answer
  • A pond located in a town was drained to make room for the new factory. Which change is likely to occur?
    9·1 answer
  • What is one way the members of a archaebacteria are different from members of eubacteria?
    6·2 answers
  • What part of your brain controls all mental activities?
    5·1 answer
  • The equations represent chemical reactions that take place in living organisms.Which reaction releases the greatest amount of en
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!