Determining minimum and maximum

Revision en4, by urparvezali, 2023-02-28 22:49:15

If you need to determine minimum and maximum in C++ from a certain value or variable then you can try it

int max = max({a,b,c});
int min = min({a,b,c});
or
int max = max({n1,n2,n3,n4....nn});
int min = min({n1,n2,n3,n4....nn});

where a,b,c and n1,n2,n3...nn are variables or values

Tags c++, hacks, tricks, competitive

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English urparvezali 2023-09-06 21:27:54 18
en6 English urparvezali 2023-09-06 21:27:27 18
en5 English urparvezali 2023-05-15 09:14:58 32
en4 English urparvezali 2023-02-28 22:49:15 53 Tiny change: 'n~~~~~\n\n' -> 'n~~~~~\n\nwhere a,b,c and n1,n2,n3...nn are variables or values'
en3 English urparvezali 2023-02-28 22:48:05 8 (published)
en2 English urparvezali 2023-02-28 22:46:18 84 (saved to drafts)
en1 English urparvezali 2023-02-28 22:44:19 361 Initial revision (published)