Posted in 面试题 onMarch 13, 2013
解:#include
main()
#define product(a,b) (a*b)
#define divide(a,b) (a/b)
{
float result,n1,n2;
printf(“input n1:”);
scanf(“%f”,&n1);
printf(“input n2:”);
scanf(“%f”,&n2);
result=product(n1,n2);
printf(“%f\n”,result);
result=divide(n1,n2);
printf(“%f/n”,result);
}
main()
#define product(a,b) (a*b)
#define divide(a,b) (a/b)
{
float result,n1,n2;
printf(“input n1:”);
scanf(“%f”,&n1);
printf(“input n2:”);
scanf(“%f”,&n2);
result=product(n1,n2);
printf(“%f\n”,result);
result=divide(n1,n2);
printf(“%f/n”,result);
}
求两个数的乘积和商数,该作用由宏定义来实现
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@