ch04_3.cpp
来自「Since the field of object oriented progr」· C++ 代码 · 共 32 行
CPP
32 行
// Chapter 4 - Programming exercise 3
#include <iostream.h>
#include <stdio.h>
int get_volume(int length, int width = 2, int height);
main()
{
int x = 10, y = 12, z = 15;
cout << "Some box data is " << get_volume(x, y, z) << "\n";
cout << "Some box data is " << get_volume(x, y) << "\n";
cout << "Some box data is " << get_volume(x) << "\n";
cout << "Some box data is " << get_volume(x, 7) << "\n";
cout << "Some box data is " << get_volume(5, 5, 5) << "\n";
}
int get_volume(int length, int width, int height)
{
printf("%4d %4d %4d ", length, width, height);
return length * width * height;
}
// Result of execution
//
// (No result - errors)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?