Increment i if new highest value occurs Increment j if new lowest value occurs
for ( auto n : arr ) { if ( h_score < n ) { h_score = n ; i ++ ; } if ( l_score > n ) { l_score = n ; j ++ ; } } cout << " Number ▁ of ▁ times ▁ maximum ▁ value ▁ " ; cout << " updated ▁ = ▁ " << i << endl ; cout << " Number ▁ of ▁ times ▁ minimum ▁ value ▁ " ; cout << " updated ▁ = ▁ " << j << endl ; }