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
People with dark brown eyes have greater amounts of the protein melanin in their irises than people with light blue eyes. The am
Elodia [21]
DNA??? I’m not sure but I’m saying DNA hope I helped!
6 0
3 years ago
Eukaryotic cells include plants, animals, fungi, and protists. They are larger and more complex than prokaryotic cells. Eukaryot
Tanzania [10]

Answer:

A. Compartmentalization maximizes the surface area where cellular processes can occur.

Explanation:

This is true because you have these foldings of membranes in different organelles in eukaryotics cells where surface area is maximized for maximum efficiency.

4 0
3 years ago
Read 2 more answers
What is a component of a phospholipid
Natalka [10]
Polar head group, hydrophobic tail.

Hope this helps!

-Payshence xoxo
7 0
3 years ago
Heat energy is transferred through solids, liquids, and gases. How is heat transferred throughout the world’s oceans?
natita [175]

Answer: Radiation, convection, and turbulent heat exchange, as well as evaporation and condensation of water vapor above the ground or ocean, transfer heat between the sea or ocean's surface and the atmosphere.

Explanation:

7 0
3 years ago
Read 2 more answers
Temperate grasslands
andrew11 [14]
Temperate grasslands is a terrestrial biomes defined by the worldwide fun for nature the predominant vegetation in this bio consists of grass and/or shrubs the climate is temperate and ranges from semi-arid to semi-humid
3 0
3 years ago
Other questions:
  • What layer of the atmosphere receives enough energy from the Sun to break apart molecules and atoms?
    8·1 answer
  • Which field of biology studies the structures if different species of animals
    13·1 answer
  • In complete metamorphosis, the immature stages are called __________. in incomplete metamorphisis, the immature stages are calle
    5·2 answers
  • Where are animal cells found
    13·2 answers
  • The two proteins directly involved in muscle contraction are broadly called . During an exercise where muscles do not shorten, c
    10·1 answer
  • Effects of corona virus in the respiratory system and circulatory system ?
    13·1 answer
  • A person who is interested in the hypothalamus and its functions might pursue a career in Group of answer choices neuroscience g
    14·1 answer
  • The counterclockwise spin of a planet or moon as seen from above the planet's north pole is known as
    9·2 answers
  • Ecologists have found that dense populations of organisms have lower birth rates, higher death rates, and slower growth rates th
    5·1 answer
  • 1)Explain what DNA means
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!