Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <ioastream>
- using namespace std;
- int max_elem(const vector<int> &a, const int &lenght)
- {
- int max_elem = -100;
- for (int i = 0; i < lenght; i++)
- {
- if(a[i]> max_elem)
- max_elem = a[i];
- }
- return max_elem;
- }
- int main()
- {
- vector<int> array = { 6, 9,66,785,632,569,56,654,2,0, 31,23,33};
- cout << max_elem(array, array.size())<< endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement