1 2 3 4 5 6 7 8 9 10 | #include <stdio.h> #define MAX(A,B) A>B?2*A:2*B int main() { int a=1,b=2,c=3,d=4,t; t=MAX(a+b,c+d); printf("%d\n",t); return 0; } |
6 考查宏定义
A>B?2*A:2*B => a+b>c+d?2*a+b:2*c+d
本题中, a+b < c+d,所以 t = 2*c+d = 2*3+4 = 10
7
1 2 3 4 5 6 7 8 9 10 | #include <stdio.h> int main() { int a=1,b=2; a+=b; b=a-b; a-=b; printf("%d,%d\n",a,b); return 0; } |
8 x y z 还是保持原值
9 考查静态变量的含义和变量的范围域
10 函数的递归调用
11 画出二维表格,实际上就是杨辉三角形
12 字符串的简单操作
13 简单结构的使用 p1 = (-1,-1) p2 =(1, 0) d = -1