三个数比较求max:两两比较
int temp=a>b?a:b;
int max=temp>c?temp:c;
syso(max);
//★int temp = ()>c?():c;//模版格式
int max = (a>b?a:b)>c?(a>b?a:b):c;//前两个比较
int min = (a<b?a:b)<c?(a<b?a:b):c;
用if实现
if (n1>n2&&n2>n3 || n2>n1&&n1>n3) {//三个数比较,每个数都有两种情况比较
min=n3;
}else if(n1>n3&&n3>n2 || n3>n1&&n1>n2){
min=n2;
}else {
min=n1;
}