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
Describe THREE things you can do to help protect the ozone layer?
Klio2033 [76]

Answer:

Avoid the consumption of gases dangerous to the ozone layer, due to their content or manufacturing process. Some of the most dangerous gases are chlorofluorocarbons, halogenated hydrocarbon, methyl bromide, and nitrous oxide.

Minimize the use of cars. The best transport options are urban, bicycle, or walking. If you use a car, try to carpool to decrease the use of cars. This prevents pollution.

Do not use cleaning products that are harmful to the environment. Many cleaning products contain substances that are corrosive. Replace these dangerous substances with non-toxic products such as vinegar or bicarbonate.

Buy local products. Not only do you get fresh products but you avoid consuming food that has traveled long distances. The more food is transported, the more nitrous oxide is produced due to the cars or trucks used to transport it.

Maintain air conditioners, as their malfunctions cause chemicals to escape into the atmosphere.

Explanation:

Hope this helped! =)

7 0
3 years ago
*URGENT*<br> Why do we think of ecosystems as systems within systems?
Alexandra [31]

Answer:

In systems, the relationships between individual parts may be more important than the parts. An ecosystem is not just a collection of species, but includes living things interacting with each other and their nonliving environment. In the systems view, the "objects" of study are networks of relationships.

Explanation:

Hope it's help

7 0
2 years ago
What term describes an enzyme
Wewaii [24]
The answer would be catalyst.
8 0
3 years ago
Read 2 more answers
Cold case detectives are investigating a homicide that took place 30 years ago. in reexamining the evidence, they find a tiny sp
vaieri [72.5K]
Polymerase chain reaction to amplify the DNA would be the technique used in the blood lab.
3 0
3 years ago
"Exercise helps a person to lose weight. Explain why."
e-lub [12.9K]

Answer:

because you burn off calories

Explanation:

moving and exercising helps burn off the calories that you consume therefore you lose weight

5 0
3 years ago
Read 2 more answers
Other questions:
  • Please help me!! I will give brainliest and thank all people who answer
    5·1 answer
  • In seed plants the sperm make it to the egg via
    5·1 answer
  • The one on the bottom
    9·1 answer
  • What group of protists can be autotrophic, heterotrophic, or both
    12·1 answer
  • Which steps are important when designing and conducting a scientific experiment?
    7·2 answers
  • 6. Calculate the kinetic energy of a baseball thrown by Aroldis Chapman, who holds the world record for fastest pitch. The baseb
    6·1 answer
  • Please help me please help me ​
    13·1 answer
  • How long does it take to refill a bowl?
    5·1 answer
  • Answer this question (30 points),
    5·1 answer
  • 20 POINTS!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!