take new largest value
if ( mat [ i ] [ j ] > secondaryMax ) { secondaryMax = mat [ i ] [ j ] ; } } } } cout << ( " Principal ▁ Diagonal ▁ Smallest ▁ Element : ▁ " ) << principalMin << endl ; cout << ( " Principal ▁ Diagonal ▁ Greatest ▁ Element ▁ : ▁ " ) << principalMax << endl ; cout << ( " Secondary ▁ Diagonal ▁ Smallest ▁ Element : ▁ " ) << secondaryMin << endl ; cout << ( " Secondary ▁ Diagonal ▁ Greatest ▁ Element : ▁ " ) << secondaryMax << endl ; }