函数题:文具盒*
c++
#include <iostream>
#include <string>
using namespace std;
class PENCIL
{
public:
PENCIL(int model);
~PENCIL();
void Show() const;
private:
int model;
};
class RULER
{
public:
RULER(int length);
~RULER();
void Show() const;
private:
int length;
};
class ERASER
{
public:
ERASER(int color);
~ERASER();
void Show() const;
private:
int color;
};
class BOX
{
public:
BOX(int pencil, int ruler, int eraser);
~BOX();
void Show() const;
private:
PENCIL pencil;
RULER ruler;
ERASER eraser;
};
/* 你提交的代码将被嵌在这里 */
int main()
{
int p, r, e;
cin >> p >> r >> e;
BOX x(p, r, e);
x.Show();
return 0;
}
#### 输入样例
in
5 15 3
#### 输出样例
out
创建铅笔(型号: 5)
创建尺(长度: 15)
创建橡皮擦(颜色: 3)
创建文具盒
铅笔(型号: 5)
尺(长度: 15)
橡皮擦(颜色: 3)
销毁文具盒
销毁橡皮擦(颜色: 3)
销毁尺(长度: 15)
销毁铅笔(型号: 5)
答案:若无答案欢迎评论