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
What is the greatest current threat to the loss of Earths biodiversity
luda_lava [24]
The greatest current threat to the loss of the Earth's biodiversity is global warming. This is because when the ice melts, the cold comes down to us and makes us have rainy summers and very early snow and cold springs and cold autumns. And when the ice melts enough, water will start to come down and flood countries and cities, such as Manhattan. Scientists are predicting that California will break away from America.
3 0
3 years ago
Read the information on predators. Then answer the questions provided. Predator-Prey Relationships Which organisms are considere
shusha [124]

Answer: A and C on edge

Explanation:

8 0
3 years ago
Read 2 more answers
The pigment in chloroplasts that absorbs light energy is called
Katen [24]

Answer: Chlorophyll

Explanation: The primary pigment used in photosynthesis, reflects green light and absorbs red and blue light most strongly

5 0
3 years ago
Read 2 more answers
Sickle-cell trait is caused by a single defective allele, but sickle-cell disease only occurs in individuals that are homozygous
Pavel [41]

Answer:

6,25%

Explanation:

Considering that the couple has a trait of sickle cell anemia, we know that both are heterozygous for the disease (Aa) and therefore can have children with the following genotypes:

Parents: Aa X Aa

Children: AA(A x A), Aa(A x a), Aa (a x A) and aa(a x a)

Knowing that sickle cell anemia only occurs in homozygous individuals, the probability for children to have the disease according to each crossing is:

A x A = 1/4 = 25%

A x a = 1/4 = 25%

a x A = 1/4 = 25%

a x a = 1/4 = 25%

The probability of forming each homozygous child (aa) is 1/4 or 25%. Since they are two children, the probability of both having sickle cell anemia is calculated by multiplying the probability of each, so:

1/4 × 1/4 = 1/16 = 0.0625 = 6.25%

It is concluded that the probability of a heterozygous couple for sickle cell anemia to have two children with the disease is 6.25%.

6 0
3 years ago
What are the five major extensions that have dramatically influence the diversity of life on earth
Otrada [13]

End Ordovician

Late Devonian

End Permian

End Triassic

End Cretaceous

6 0
4 years ago
Other questions:
  • Blood is a ________.
    9·1 answer
  • If you had high blood pressure, you would want to be especially careful when using: selective serotonin reuptake inhibitors. tri
    9·1 answer
  • The ability of a process to be repeated in the same manner by another individual is called
    7·2 answers
  • Which statement about vacuoles is true
    14·1 answer
  • When does independent assortment occur
    12·2 answers
  • If a whitefish blastula begins as a single cell, how many mitotic divisions will it take to generate 16 cells?
    13·1 answer
  • How can your digestive system fit inside your body?
    15·1 answer
  • Experimental studies reveal that double-stranded DNA can exist in three different helical forms known as A, B, and Z DNA. Why do
    9·2 answers
  • How do non-native species affect the populations within the ecosystem where they are introduced?
    8·2 answers
  • What type of fish is this?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!