#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> vectorObject(5);
int i;
vectorObject[0] = 1;
vectorObject[1] = 2;
vectorObject[2] = 5;
vectorObject[3] = 9;
vectorObject[4] = 2;
cout << "Contents of vectorObject: ";
for(i = 0; i <vectorObject.size(); i++)
cout << vectorObject[ i ] << " ";
cout << endl;
cout << "Maximum element is: ";
cout << *max_element(vectorObject.begin(), vectorObject.end());
cout << endl;
cout << "Minimum element is: ";
cout << *min_element(vectorObject.begin(), vectorObject.end());
return 0;
}
|