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

📄 prog12_04.cpp

📁 c++最经典的入门书籍
💻 CPP
字号:
// Program 12.4 Using a class with private data members   File: prog12_04.cpp 
#include <iostream>
#include "Box.h"

using std::cout;
using std::endl;

int main() {
  cout << endl;

  Box firstBox(2.2, 1.1, 0.5);
  Box secondBox;
  Box* pthirdBox = new Box(15.0, 20.0, 8.0);

  cout << "Volume of first box = "
       << firstBox.volume()
       << endl;

//  secondBox.length = 4.0;                  // Uncomment this line to get an error

  cout << "Volume of second box = "
       << secondBox.volume()
       << endl;

  cout << "Volume of third box = "
       << pthirdBox->volume()
       << endl;

  delete pthirdBox;
  return 0;
}

⌨️ 快捷键说明

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