正在加载图片...
例求三个数中的最大值。其中,求两个数中的 较大数用宏定义实现。 #include <stdio h> #define MaX(x,y)(x)>(y)? (x): (y) maino f float a, b, c, t; printf("please intput 3 real number a, b, c: scanf("%f, %f, %f", &a, &b, &c) tMAX(a, b) printf(" The max number is %/0.2f MAX(t, c))例 求三个数中的最大值。其中,求两个数中的 较大数用宏定义实现。 #include <stdio.h> #define MAX(x,y) (x)>(y)?(x):(y) main() { float a,b,c,t; printf("Please intput 3 real number a,b,c:"); scanf("%f,%f,%f",&a,&b,&c); t=MAX(a,b); printf("The max number is %0.2f",MAX(t,c)); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有