📄 bundle.cpp.html
字号:
<html>
<head>
<title>bundle.cpp</title>
</head>
<body>
<pre> 1 #include "bundle.h"
2
3 void Bundle::add(Item* it)
4 {
5 items.push_back(it);
6 }
7
8 double Bundle::get_unit_price() const
9 {
10 double price = 0;
11 for (int i = 0; i < items.size(); i++)
12 {
13 price = price
14 + items[i]->get_unit_price() * items[i]->get_quantity();
15 }
16 return price;
17 }
18
19 string Bundle::get_description() const
20 {
21 string description = "";
22 for (int i = 0; i < items.size(); i++)
23 {
24 if (i > 0) description = description + ", ";
25 description = description + items[i]->get_description();
26 }
27 return description;
28 }
29
30 int Bundle::get_quantity() const
31 {
32 return 1;
33 }
34
35 </pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -