please esxplain me how to find max element in the vector using inbuilt functon max_element() given that element should not prestent in partuicular position ,does need to pass the another parameter in it
int m3=*max_element(w.begin(),w.end());
In the given inbuilt function how to find max element if that not present in particular position int m3=*max_element(w.begin(),w.end());
@kailash_01
Hello Kailash,
the syntax you mentioned (i.e int m3=*max_element(w.begin(),w.end()); ) will give you maximum element from the all the elements present in the vector (position doesnt matter) . you no need to give any extrra parameter to find max.
if still it is not clear then please feel free to ask
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.