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
An eagle on a tree branch sees an injured squirrel 50 meters away on the ground. The eagle then flies from the tree to prey on t
BigorU [14]
B. The eagles brain recognized the squirrel as prey
4 0
3 years ago
Read 2 more answers
The location of oxygen is represented by ___,
Sholpan [36]

Answer:

B. label b

Explanation:

po ang answer itry my best

4 0
2 years ago
PLS HELP ME
DanielleElmas [232]

Answer:

100% Heterozygous Dominant (Rr)

Hope this helps!

3 0
3 years ago
Some organisms can reproduce by "cloning" themselves, an asexual process. which type of organism is least able to naturally repr
laila [671]

Mammals is the type of organism that least naturally reproduced by cloning. Mammals reproduced by Sexual reproduction typically requires the sexual interaction of two specialized organisms, called gametes, which contain half the number of chromosomes of normal cells and are made by meiosis, which usually a male fertilizing a female.

7 0
3 years ago
What is multicellular organismss
mihalych1998 [28]

Answer:

Multicellular organisms can be described as an organism which is made up of multiple cells. A unicellular organism is made up of only a single cell. Multicellular organisms are complex organisms as they are made up of more than one cell. Unicellular organisms are simple organisms as they constitute of only a single cell.

Examples of a multicellular organism include humans, elephants, bats, rats, cats etc.

Example of a unicellular organism is bacteria.

6 0
3 years ago
Read 2 more answers
Other questions:
  • The elements of the Earth undergo chemical reactions that build molecules, destroy molecules, and change molecules into other mo
    9·1 answer
  • _____ coined the term sociology and first elaborated the positivist basis of sociology.
    7·1 answer
  • Is it possible for an object at rest to have forces acting upon it?
    13·2 answers
  • How do you care for a person with a possible head, neck or spinal injury?
    13·1 answer
  • The crust’s role in _______ allows it to provide the raw materials necessary for life on earth.
    10·2 answers
  • Which description is true about eukaryotes but not prokaryotes
    6·2 answers
  • He creationist and evolutionist are in agreement on all of the following items except:
    11·1 answer
  • What day of the year marks the start of the spring season in the Northern Hemisphere when day and night are both about 12 hours
    6·2 answers
  • What would happen if cytokinesis failed?
    15·1 answer
  • What Emma pushes a bag with a force of 27 Newton's the coefficient of Connecticut friction between the bag and the floor is 0.23
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!