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
Jesslyn needs to create a project that shows geographic isolation in action and decides to make a video which of the following w
KatRina [158]

Answer:

Easter Island

Fiji

Hawaii Island

Explanation:

6 0
3 years ago
Science help thank you
DaniilM [7]

Answer:

I think it's d

Explanation:

I remember from a couple years ago I had to answer a question similar to this. I'm 90% sure I chose the last answer.

only choose my answer if you agree.

4 0
3 years ago
The ________ is a microtubule structure that binds to sister chromatids to separate them in anaphase
BaLLatris [955]
The answer is spindle fiber.
6 0
3 years ago
Which of the following is themes accurate description of how flatworms and people remove waste from their body?
oksano4ka [1.4K]

Answer:

A

Explanation:

8 0
3 years ago
Hitch two organs make and/or store bile
evablogger [386]
Chemical digestion<span> in the </span>small intestine<span> relies on the activities of three </span>accessory digestive organs<span>: the </span>liver<span>, </span>pancreas<span>, and </span><span>gallbladder.</span>
7 0
3 years ago
Other questions:
  • What are the parts of the heart?
    13·2 answers
  • How does the circulatory system work at the organ level?
    14·2 answers
  • What does the fiber in diet pills do? it satisfies a person's normal daily fiber requirement. it has been clinically demonstrate
    15·1 answer
  • Which of the following would cause the molecules in matter to change?
    9·1 answer
  • A friend throws a coin into a pool. You close your eyes and dive toward the spot where you saw it from the edge of the pool. Whe
    12·2 answers
  • Types if fruit and seed dispersal
    11·2 answers
  • What happens when lakes are acidified?
    12·1 answer
  • WHAT IS THE BEST CONCLUSION FOR MR KRABBS TO DETERMINE?
    12·2 answers
  • Somatic cells divide by ___________________ to provide two identical daughter cells that look like the original cell while sex c
    7·2 answers
  • 13. What innovation did Jethro Wood add to plows in the 1800s?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!