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 08:00
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
You know the right answer?
Complete the program below by filling in code. #include
#include
#include
#inc...
Questions
question
Mathematics, 23.05.2020 20:57
Questions on the website: 13722367