填空题 下列程序的招待结果是 【14】
# include <iostream. h>
float temp;
float & fn2(float r)

temp=r* r* 3.14;
return temp;

void main( )

float a=fn2(5.0);
float& b=fn2(5.0)
b=20;
cout<<temp<<end1;


  • 1、
【正确答案】 1、20    
【答案解析】[解析] 本题考察全局变量和引用的综合使用。在主函数中,b实际上是temp的一个引用。因此在给b赋值20的时候,输出的temp就是20。