try something like this. because you are limited to while/if loops its kinda of primitive but it should work.
int i=0;
temp=0;
cin>>Nitems>>endl;
while(i<(number of items)){
cin>>number>>endl;
if(number>temp)
number = max;
i++;
}
putting that into a function and make it return max should get you what you want.
Last edited by Barefootsanders; Nov 12th, 2006 at 11:23 pm.