answer.
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]
2 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]2 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
Spirometry results reveal a vital capacity of two liters which is well below the predicted value of five liters. this suggests w
Firlakuza [10]
The answer is <span>restrictive disease.

</span>Restrictive disease it's when the total lung volume is too low. The normal value is 5 liters and 2 liters would be classified as restrictive disease.
It increased work of breathing and causes inadequate oxygenation.
 
Spirometry is not 100% accurate diagnosis because there is always residual lung volume that can't be measured but it's still very good to diagnose.

7 0
2 years ago
Solar power is a renewable resource because _______.
Mamont248 [21]
<span>Solar power is a renewable resource because </span><span>it is continually replenished.</span><span>
</span><span>Final answer: A</span><span> </span>
3 0
2 years ago
Read 2 more answers
Which would be the best laboratory tool to measure 6 ml of water?
ICE Princess25 [194]
A graduated cylinder would be best when measuring small liquid volumes.
3 0
2 years ago
Read 2 more answers
Bass pro shops recognizes that outdoors enthusiasts are a diverse group. likely segments include hunters, campers, and boaters.
Brilliant_brown [7]
Psychographic segmentation includes separating your market into fragments in view of various identity characteristics, values, states of mind, premiums, and ways of life of purchasers. This division is beneficial in light of the fact that it enables you to participate in item plan and showcasing in an engaged way.
6 0
2 years ago
which of the following is true about totipotent cells? A.) Embryonic stem cells are totipotent cells. B.) Totipotent cells can d
Savatey [412]
I think C is correct.
8 0
2 years ago
Read 2 more answers
Other questions:
  • The action of helicase creates _____. the action of helicase creates _____. primers and replication bubbles replication forks an
    5·1 answer
  • The diagram below shows some relationships between ecosystems near the Sonoran and Chihuahuan Deserts. In which category does th
    15·2 answers
  • A hydra is an aquatic organism that lives in fresh water. During reproduction an outgrowth begins to form on the parent. The out
    9·2 answers
  • How is the muscular foot of a squid different from that of clams and snails
    10·1 answer
  • Actin filaments have polarity. This means that the two ends can be identified due to structural differences. The plus end is the
    12·1 answer
  • Somatic cells of roundworms have four individual chromosomes per cell. How many chromosomes would you expect to find in an ovum
    8·1 answer
  • Ethylene causes fruits to ripen. In a signaling pathway, receptors activate transcription factors, which ultimately leads to rip
    8·1 answer
  • The lower esophageal sphincter surrounds the upper opening into the stomach. If this sphincter failed to properly constrict, the
    5·1 answer
  • What is it called when the forest remains but its richness and well-being have deteriorated?
    14·1 answer
  • Which of the following best explains the potential health problems associated with endocrine disruptors? A) Endocrine disruptors
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!