ch9_6.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:
C#编程
开发平台:
Visual C++
- //*********************
- //** ch9_6.cpp **
- //*********************
- #include <iostream.h>
- float temp;
- float fn1(float r)
- {
- temp = r*r*3.14;
- return temp;
- }
- float& fn2(float r)
- {
- temp = r*r*3.14;
- return temp;
- }
- void main()
- {
- float a=fn1(5.0); //1
- float& b=fn1(5.0); //2:warning
- float c=fn2(5.0); //3
- float& d=fn2(5.0); //4
- cout<<a<<endl;
- cout<<b<<endl;
- cout<<c<<endl;
- cout<<d<<endl;
- }