3_15.cpp
来自「《C++语言程序设计(第2版)》例题程序」· C++ 代码 · 共 25 行
CPP
25 行
#include <iostream.h>
#include <iomanip.h>
int get_volume(int length, int width = 2, int height = 3);
int main()
{
int x = 10, y = 12, z = 15;
cout << "Some box data is " ;
cout << get_volume(x, y, z) << endl;
cout << "Some box data is " ;
cout << get_volume(x, y) << endl;
cout << "Some box data is " ;
cout << get_volume(x) << endl;
cout << "Some box data is ";
cout << get_volume(x, 7) << endl;
cout << "Some box data is ";
cout << get_volume(5, 5, 5) << endl;
return 0;
}
int get_volume(int length, int width, int height)
{
cout<<setw(5)<<length<<setw(5)<<width<<setw(5)<<height<<' ';
return length * width * height;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?