#define f( a,b,x ) a*x+b原题:下列程序段的输出是 _______ .#define f(a,b,x) a*x+bprintf("%d,%dn",f(3,2,1),f(6,5,f(3,2,1)));第二个我以为是35 可为什么是25?我是这样想的:6 * f(3,2,1) + 5 = 6 * 5 + 5 = 35

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 01:33:38

#define f( a,b,x ) a*x+b原题:下列程序段的输出是 _______ .#define f(a,b,x) a*x+bprintf("%d,%dn",f(3,2,1),f(6,5,f(3,2,1)));第二个我以为是35 可为什么是25?我是这样想的:6 * f(3,2,1) + 5 = 6 * 5 + 5 = 35
#define f( a,b,x ) a*x+b
原题:
下列程序段的输出是 _______ .
#define f(a,b,x) a*x+b
printf("%d,%dn",f(3,2,1),f(6,5,f(3,2,1)));
第二个我以为是35 可为什么是25?
我是这样想的:6 * f(3,2,1) + 5 = 6 * 5 + 5 = 35

#define f( a,b,x ) a*x+b原题:下列程序段的输出是 _______ .#define f(a,b,x) a*x+bprintf("%d,%dn",f(3,2,1),f(6,5,f(3,2,1)));第二个我以为是35 可为什么是25?我是这样想的:6 * f(3,2,1) + 5 = 6 * 5 + 5 = 35
宏定义是编译前的简单字符串替换,不是其他类型参数的替换,不经过计算,没有错误处理,所以
f(6,5,f(3,2,1)))替换结果就是
6*f(3,2,1)+5
=6*3*1+2+5
=25
这样写宏定义时一定注意括号
简单函数功能可使用内联函数来做

#define F(a) #define A B 关于定积分~错哪儿了?急~# include # define N 100# define F(x) (x)*(x)*(x)float sab(float a,float b){ float h,sum=0; scanf(%f%f,&a,&b); h=(b-a)/N; for(;a #define LT(a,b) ((a) #define f(a,b,x) a*x+b #include void main() printf(%d,%d ,f(3,2,1),f(6,5,f(3,2,1))) #define f(a,b,x) a*x+b printf(%d,%d ,f(3,2,1),f(6,5,f(3,2,1))); #define f(x) x*x main() {int a=6,b=2,c; C=f(a)?f(b); printf(%d ,c);} # define A 3 # define B(a) (( A + 1 )*a ) M x = 3*( A + B( 7 ) ) ;# define A 3# define B(a) (( A + 1 )*a )Mx = 3*( A + B( 7 ) ) ;这个要怎么解答 #define F(x,y)x*(y) void main() {int a=3,b=4,c; c=F(a+b,(a++)+(b++));#define F(x,y)x*(y) void main() {int a=3,b=4,c; c=F(a+b,(a++)+(b++)); printf(%d/n,c);} 答案是31,求详解. #define f( a,b,x ) a*x+b原题:下列程序段的输出是 _______ .#define f(a,b,x) a*x+bprintf(%d,%dn,f(3,2,1),f(6,5,f(3,2,1)));第二个我以为是35 可为什么是25?我是这样想的:6 * f(3,2,1) + 5 = 6 * 5 + 5 = 35 #include #define A 2 #define B(x) x*(A+2) void main() { int a=5; printf(%d ,B(a+1)); } #include #define f(a,b,x) a*x+b void main() { printf(%d,%d ,f(3,2,1),f(6,5,f(3,2,1))); }怎么得到5,25的? #include #define f(x) x*x main() {int a=6,b=2,c; c=f(a)/f(b); printf(%d ,c); }为什么上面的程序输出结果为36 求表达式B/B的值?#define A 3+2 #define B A*A #define M(x) x*x int a=3,b=2; M(a+b)/M(a+b)=? #define max(a,b) a>b?a:b中的?和: #define MA(x) x*x-1 int a=1,b=2; cout #includestdio.h #define F(y) 3.84+y #define PR(a) printf(%d,(int)(a)) main(){ int x=3; PR(F(3)*#includestdio.h#define F(y) 3.84+y#define PR(a) printf(%d,(int)(a))main(){int x=3;PR(F(3)*x); }为什么结果是12啊?