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 17: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 17:30
How do you make a lenny face? plz, brailiest to who can answer first.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
You know the right answer?
Complete the program below by filling in code. #include
#include
#include
#inc...
Questions
Questions on the website: 13722361