问题
单项选择题
有以下程序
#include<iostream.h>
float fun(int x,int y)
return(x+y);
void main( )
int a=2,b=5,c=8;
cout<<fun((int)fun(a+c,b) ,a-c) ;
程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9.0
答案
参考答案:B
解析: 本题的运算过程是fun((int)fun (a+c,B,a-C,fun((int)fun(10,5),2-8),fun ((int)15.000000,-6),fun(15,-6)=9。