subject

Complete the program below by filling in code. #include
#include
#include
#include
using namespace std;

void print(const string& title, const vector& v)
{
cout << title << " ";
for (int i = 0; i < v. size(); i++)
cout << v[i] << " ";
cout << endl;
}

int main()
{
vector v;
for (int i = 0; i < 5; i++)
v. push_back(i);

FILL_CODE
FILL_CODE

print("The elements in vector:", v);

sort(v. begin(), v. end()); // Sort the elements in v
print("Sorted elements:", v);

random_shuffle(v. begin(), v. end()); // Shuffle the elements in v
print("After random shuffle:", v);

cout << "The max element is " <<
*max_element(v. begin(), v. end()) << endl;

cout << "The min element is " <<
*min_element(v. begin(), v. end()) << endl;

int key = 45;
if (find(v. begin(), v. end(), key) == v. end())
cout << key << " is not in the vector" << endl;
else
cout << key << " is in the vector" << endl;

return 0;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print?
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
Which of the choices sean are not true when considering virus behavior
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
You know the right answer?
Complete the program below by filling in code. #include
#include
#include
#inc...
Questions
question
Biology, 12.03.2020 00:01
question
History, 12.03.2020 00:01
question
Health, 12.03.2020 00:01
question
Mathematics, 12.03.2020 00:01
Questions on the website: 13722362