Question: please solve all question, thx.(c++) 1. Define a vector of integers that contains the first five prime numbers (2, 3, 5, 7, and 11). Use

please solve all question, thx.(c++)

1. Define a vector of integers that contains the first five prime numbers (2, 3, 5, 7, and 11). Use push_back to add the elements.

2. Answer the first question without using push_back.

3.Suppose you want to store a set of temperature measurements that is taken every five minutes. Should you use a vector or an array?

4.Suppose you want to store the names of the weekdays. Should you use a vector or an array of seven strings?

5. Write a predicate function

bool same_elements(vector a, vector b)

that checks whether two vectors have the same elements in some order, with the same multiplicities.

For example, 1 4 9 16 9 7 4 9 11 and 11 1 4 9 16 9 7 4 9 would be considered identical, but

1 4 9 16 9 7 4 9 11 and 11 11 7 9 16 4 1 would not. You will probably need one or more helper functions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!