1. Loads a vector with at least 60 randomly generated integers in the range of 0 - 49.  2. Create method to display the values in the vector.   3. Use the following STL templates and display the vector contents for each template used. sort() random_shuffle() Display the result of max_element() Display the result of min_element() #include #include #include using namespace std; const int MAX_COUNT = 60; const int CEILING = 50; int main() { vectormyList; for (int idx = 0; idx < MAX_COUNT; idx++) { int myNbr = (rand() % CEILING); myList.push_back(myNbr); cout << "myNbr = " << myNbr << endl; } cout << "Size = " << myList.size() << endl; return 0;

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

 1. Loads a vector with at least 60 randomly generated integers in the range of 0 - 49. 

2. Create method to display the values in the vector.

 

3. Use the following STL templates and display the vector contents for each template used.

  1. sort()
  2. random_shuffle()
  3. Display the result of max_element()
  4. Display the result of min_element()

#include <iostream>
#include <vector>
#include <ctime>
using namespace std;

const int MAX_COUNT = 60;
const int CEILING = 50;

int main() {

vector<int>myList;
for (int idx = 0; idx < MAX_COUNT; idx++) {

int myNbr = (rand() % CEILING);
myList.push_back(myNbr);
cout << "myNbr = " << myNbr << endl;
}

cout << "Size = " << myList.size() << endl;
return 0;
}

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning