⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.cpp

📁 Since the field of object oriented programming is probably new to you, you will find that there is a
💻 CPP
字号:
                               // Chapter 4 - Program 4 - DEFAULT.CPP
#include <iostream.h>
#include <stdio.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 " << 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 ";
   cout << get_volume(x, 7) << "\n";
   cout << "Some box data is ";
   cout << get_volume(5, 5, 5) << "\n";

   return 0;
}

int get_volume(int length, int width, int height)
{
   printf("%4d %4d %4d   ", length, width, height);
   return length * width * height;
}




// Result of execution
//
//   10   12   15Some box data is   1800
//   10   12    3Some box data is    360
//   10    2    3Some box data is     60
// Some box data is   10    7    3   210
// Some box data is    5    5    5   125

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -