引用返回值的问题
# include <iostream.h>
float temp;
float fn1(float r)
{
temp=(float)(r*r*3.14);
return temp;
}
float &fn2(float r)
{
temp=(float)(r*r*3.14);
return temp;
}
void main()
{
float a=fn1(10.0);
//float & b=fn1(10.0);
float c=fn2(10.0);
float &d=fn2(10.0);
cout<<"a="<<" "<<a<<endl;
//cout<<"b="<<" "<<b<<endl;
cout<<"c="<<" "<<c<<endl;
cout<<"d="<<" "<<d<<endl;
}
我不明白这里a,b,c,d如何操作,或被操作的?望大家给点点!