Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 625 Bytes

49.md

File metadata and controls

38 lines (34 loc) · 625 Bytes

题目:#if #ifdef和#ifndef的综合应用。

#include<stdio.h>
#define MAX
#define MAXIMUM(x,y) (x>y)?x:y
#define MINIMUM(x,y) (x>y)?y:x
int main()
{
	int a = 10, b = 20;
#ifdef MAX
	printf("w 大 %d\n", MAXIMUM(a, b));
#else
	printf("w 小 %d\n", MINIMUM(a, b));
#endif

#ifndef MIN
	printf("x 小 %d\n", MINIMUM(a, b));
#else
	printf("x 大 %d\n", MAXIMUM(a, b));
#endif

#undef MAX
#ifdef MAX
	printf("y 大 %d\n", MAXIMUM(a, b));
#else
	printf("y 小 %d\n", MINIMUM(a, b));
#endif

#define MIN
#ifndef MIN
	printf("z 小 %d\n", MINIMUM(a, b));
#else
	printf("z 大 %d\n", MAXIMUM(a, b));
#endif

	return 0;
}