weixin_55317608 2021-02-22 21:30 采纳率: 81.8%
浏览 98
已采纳

c++填空题(bool数据类型) 请大虾指点

#include<iostream>

#include<string>

using namespace std;

string mark[2]={"is not","is"};

class Brand

{public:

string name;

int year;

public:

Brand(string s,int n)

{name=s;year=n;

cout<<"class Brand is created"<<endl;}

~Brand(){cout<<"class Brand is destroyed"<<endl;}

};

class writeTool

{

        1             ) 

bool isHard;

public:

writeTool(bool iH)

{isHard=iH;

cout<<"class writeTool is created"<<endl;}

~writeTool(){cout<<"class writeTool is destroyed"<<endl;}

};

class Pen:(           2              

{Brand brand;

int colorcode;

public:

Pen (          3              ):writeTool(iH),brand(ss,yy)

{colorcode=cc;

cout<<"class pen is created"<<endl;}

void show()

{

cout<<"colorcode:"<<colorcode<<endl;

cout<<"This writing tool"<<mark[isHard]<<"hard for thin papers."endl;

cout<<"The brand"<<brand.name<<"has exist for"<<hrand.year <<"year"<<endl;}

~Pen(){cout<<"class pen is destroyed"<<endl;}

};

int main()

{Pen pen(10,true,"handsome",1950);

(             4              );

return 0;}

 

  • 写回答

2条回答 默认 最新

  • ProfSnail 2021-02-22 22:00
    关注

    1 public:

    2 public Brand

    3 int cc, bool iH, string ss, int yy

    4 pen.show();

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题