#include <stdio.h>
int main()
{
int score1,score2,score3;
scanf("%d %d %d",&score1,&score2,&score3);
if(score1>score2){
if(score1>score3){
printf("max=%d ",score1);
if(score2 > score3)
printf("mid=%d min=%d\n",score2,score3);
else
printf("mid=%d min=%d\n",score3,score2);
}else{
printf("max=%d mid=%d min=%d\n",score3,score1,score2);
}
}else{
if(score2>score3){
printf("max=%d ",score2);
if(score1 > score3)
printf("mid=%d min=%d\n",score1,score3);
else
printf("mid=%d min=%d\n",score3,score1);
}else{
printf("max=%d mid=%d min=%d\n",score3,score2,score1);
}
}
return 0;
}
#include<stdio.h>
int main()
{
int fighting[3]={0};
scanf("%d %d %d",&fighting[0],&fighting[1],&fighting[2]);
int max = fighting[fighting[0]>fighting[1]?0:1]>fighting[2]?(fighting[0]>fighting[1]?0:1):2;
int min = fighting[fighting[0]<fighting[1]?0:1]<fighting[2]?(fighting[0]<fighting[1]?0:1):2;
int mid = 3-max-min;
printf("max=%d,mid=%d,min=%d\n",fighting[max],fighting[mid],fighting[min]);
return 0;
}
我是这样写的,但是是错的