/*1.调用通过引用返回值的函数。
2.符号&。*/
#include<iostream>
usingnamespace std;
void cube_vol_area(int,double,double,double,double&,double&);
int main()
{
int id=5;
double a,v;
double x=6.3,y=7.2,z=1.5;
cube_vol_area(id,x,y,z,a,v);
cout<<"cube surface area="<<a<<"cube volume="<<v<<endl;
}
void cube_vol_area(int id,double width,double length,double height,
double&surface_area,double&volume)
{
cout<<"For cube id="<<id<<endl;
surface_area=2*width*height+2*length*height+2*width*length;
volume=width*length*height;
}
/*引用:函数声明中的引用符号&用来说明值能被函数修改的参数。注意,函数变量中surface_area和volume不占内存,
并且引用时不用加上&符号。*/