diff --git a/2207/C语言同步练习源码/6-预处理-1.c b/2207/C语言同步练习源码/6-预处理-1.c new file mode 100644 index 0000000..32b4bf4 --- /dev/null +++ b/2207/C语言同步练习源码/6-预处理-1.c @@ -0,0 +1,11 @@ +#include +#define MAXD(x, y) (x>y?x:y) + +int main(){ + int a, b; + scanf("%d %d", &a, &b); + //(1>2?1:2) 将MAXD替换成三目运算符 + printf("%d \n", MAXD(a, b)); + + return 0; +} \ No newline at end of file diff --git a/2207/C语言同步练习答案.md b/2207/C语言同步练习答案.md index 3c1f595..9cae841 100644 --- a/2207/C语言同步练习答案.md +++ b/2207/C语言同步练习答案.md @@ -870,7 +870,19 @@ int main(){ ![image-20250227231302316](https://yp.smallkun.cn/markdown/image-20250227231302316.png!compress) +```c +#include +#define MAXD(x, y) (x>y?x:y) +int main(){ + int a, b; + scanf("%d %d", &a, &b); + //(1>2?1:2) 将MAXD替换成三目运算符 + printf("%d \n", MAXD(a, b)); + + return 0; +} +``` ### 预处理-2