How to find the maximum element in deque using C++

1 Answer

0 votes
#include <iostream>
#include <deque>
#include <algorithm>

using std::deque;
using std::cout;
using std::endl;

int main()
{
	deque<int> dq = { 3, 6, 9, 7, 1, 2 };

	cout << *max_element(dq.cbegin(), dq.cend()) << endl;

	return 0;
}


/*
run:

9

*/

 



answered Jan 30, 2018 by avibootz

Related questions

1 answer 282 views
1 answer 176 views
1 answer 306 views
1 answer 229 views
...