个人认为用?:更好哦
程序代码:
#include<stdio.h> #define MAX(a,b) (a)>=(b)?(a):(b) #define MIN(a,b) (a)<=(b)?(a):(b) main(void) { int a,b,c,d,max,min; scanf("%d%d%d%d", &a,&b,&c,&d); max=MAX(MAX(a,b),MAX(c,d)); min=MIN(MIN(a,b),MIN(c,d)); printf("max:%d,min:%d\n", max,min); }个人认为最简单的程序