Please explain me how to find max element in vector w and that should not present at particular position as if w={1,2,3,4} max is 4 but it is at w[3 ] position so max is 3 in inbuilt function

int m3=*max_element(w.begin(),w.end());

Hi ,Kailash
if i understood correctly , your question is how to find maximum element that should not be present at a particular position ,
what you can do is just run a loop and when you reach the index that should not be considered , using if condition ignore that index and perform normal operation of finding the maximum element
refer this -> https://ide.codingblocks.com/s/180178