好友
阅读权限10
听众
最后登录1970-1-1
|
来源:http://www.eviler.cn
QUOTE:
#include <iostream.h>
//默认参数的用法
//计算长方体的体积
inline int Volume (int length=1,int width=1,int height=1)
{return length * width * height;}
main()
{
cout<<"the default box volume is:"
<< Volume()
<<"\n\nThe volume of a box with kenghe 10,\n"
<<"width 1 and height 1 is:"
<< Volume(10)
<<"\n\nThe volume of a box with kenghe 10,\n"
<<"width 5 and height 1 is:"
<< Volume(10,5)
<<"\n\nThe volume of a box with kenghe 10,\n"
<<"width 5 and height 2 is:"
<< Volume(10,5,2)
<<'\n';
return 0;
} |
|