当前位置: 首页 > news >正文

wordpress内容评论可见seo搜索引擎营销工具

wordpress内容评论可见,seo搜索引擎营销工具,案例展示在网站中的作用,赶集网招聘第五章 静态成员与友元 一、填空题 1、一个类的头文件如下所示&#xff0c;num初始化值为5&#xff0c;程序产生对象T&#xff0c;且修改num为10&#xff0c;并使用show()函数输出num的值10。 #include <iostream.h> class Test { private: static int num; publi…

第五章  静态成员与友元

一、填空题

    1、一个类的头文件如下所示,num初始化值为5,程序产生对象T,且修改num为10,并使用show()函数输出num的值10。

#include <iostream.h>

class Test

{ private:

static int num;

public:

Test(int);

void show();

};

__int test::num = 5;_______

Test::Test(int n)

{ num=n; }

void Test::show()

{ cout<<num<<endl; }

void main()

{ Test t(10);

__t.show();_______

}

  2 、在下面程序的底画线处填上适当的字句,使该程序执行结果为40。

#include <iostream>

class Test

{ public:

____static int x__;

Test (int i=0)

{x=i+x;}

int Getnum()

{return Test::x+7;}

};

Int test::x=33_______;

void main()

{Test test;

cout<<test.Getnum()<<endl;

}

3 、下列程序运行的结果是___________

     #include <iostream.h>

#include <string.h>

#include <iomanip.h>

class student

{char name[8];

int deg;

char level[7];

friend class process; // 说明友元类

public:

student(char na[],int d)

{ strcpy(name,na);

deg=d;

}

};

class process

{ public:

void trans(student &s)

{int i=s.deg/10;

switch(i)

{case 9:

strcpy(s.level, "优");break;

case 8:

strcpy(s.level,"良");break;

case 7:

strcpy(s.level,"中");break;

case 6:

strcpy(s.level,"及格");break;

default:

strcpy(s.level,"不及格");

}

}

void show(student &s)

{cout<<setw(10)<<s.name<<setw(4)<<s.deg<<setw(8)<<s.level<<endl;}

};

void main()

{ student st[]={student("张三",78),student("李四",92),student("王五

",62),student("孙六",88)};

process p;

cout<<"结 果:"<<"姓名"<<setw(6)<<"成绩"<<setw(8)<<"等级"<<endl;

for(int i=0;i<4;i++)

{ p.trans(st[i]);

p.show(st[i]);}

}

 姓名   成绩   等级

 张三   78     中

 李四   92     优

 王五   62     及格

 孙六   88     良

二、编程题

1.

 (1) 编写一个类,声明一个数据成员和一个静态数据成员。让构造函数初始化数据成员,并把静态数据成员加1,让析构函数把静态数据成员减1。

 (2) 根据(1)编写一个应用程序,创建三个对象,然后显示它们的数据成员和静态数据成员,再析构每个对象,并显示它们对静态数据成员的影响。

 (3) 修改(2),让静态成员函数访问静态数据成员,并让静态数据成员是保户的。

#include <iostream>using namespace std;class AAA
{friend int static_re();
private:int a;
protected:static int b;
public:AAA(int a):a(a){b++;}~AAA(){b--;cout << "b=" << b << endl;}int get_int(){return a;}static int get_static(){return b;}
};int static_re()
{AAA::b=100;cout << "B:" << AAA::b << endl;return AAA::b;
}int AAA::b=0;int main()
{AAA a1(10),a2(20),a3(30);cout << "a1_int=" << a1.get_int() << endl;cout << "a2_int=" << a2.get_int() << endl;cout << "a3_int=" << a3.get_int() << endl;cout << "static=" << a1.get_static() << endl;static_re();return 0;
}

2.

 (1) 下述代码有何错误,改正它。

#include < iostream>

using namespace std;

class Animal;

void SetValue(Animal&, int);

void SetValue(Animal&, int, int);

class Animal

{

public:

    friend void SetValue(Animal&, int);

protected:

int itsWeight;

int itsAge;

};

void SetValue(Animal& ta, int tw)

{

    a.itsWeight = tw;   ---》ta.itsWeight=tw;

}

void SetValue(Animal& ta, int tw, int tn)

{

    ta.itsWeight = tw;

    ta.itsAge = tn;

}

int main()

{

    Animal peppy;

    SetValue(peppy, 5);

    SetValue(peppy, 7,9);

 

return 0;

}

 (2) 将上面程序中的友员改成普通函数,为此增加访问类中保护数据的成员函数。

#include <iostream>class Animal {
public:void SetValue(int);void SetValue(int, int);protected:int itsWeight;int itsAge;};void Animal::SetValue(int tw) {itsWeight = tw;}void Animal::SetValue(int tw, int tn) {itsWeight = tw;itsAge = tn;}int main() {Animal peppy;peppy.SetValue(5);peppy.SetValue(7, 9);return 0;}

3. 重新编写下述程序,使函数Leisure()成为类Car和类Boat的函数。作为重新编程,在类Car和类Boat中,增加函数set()。

#include < iostream>

using namespace std;

class Boat;

class Car

{

public:

    Car(int j){size = j;}

    friend int Leisure(int time, Car& aobj, Boat& bobi);

protected:

    int size;

class Boat

{

public:

    Boat(int j){size = j;}

    friend int Leisure(int time, Car& aobj, Boat& bobj);

protected:

    int size;

};

int Leisure(int time, Car& aobj, Boat& bobi)

{

    return time * aobj.size *bobi.size;

}

};

int main()

{

    Car c1(2);

    Boat bl(3);

    int time = 4;

    cout << Leisure(time, cl,bl);

 

return 0;

}

 

 #include <iostream>
using namespace std;class Boat;class Car {
public:Car(int j) { size = j; }int Leisure(int time, Boat& bobj);void set(int j) { size = j; }private:int size;
};class Boat {
public:Boat(int j) { size = j; }int Leisure(int time, Car& aobj);void set(int j) { size = j; }private:int size;
};int Car::Leisure(int time, Boat& bobj) {return time * size * bobj.size;
}int Boat::Leisure(int time, Car& aobj) {return time * size * aobj.size;
}int main() {Car c1(2);Boat bl(3);int time = 4;cout << c1.Leisure(time, bl) << endl;return 0;
}

http://www.hkea.cn/news/279657/

相关文章:

  • 大数据营销是什么seo站长
  • 建设政府网站的公司乐山网站seo
  • 仿站容易还是建站容易专业做灰色关键词排名
  • 做网站背景音乐管理课程培训
  • 网站建设可以自学吗品牌软文范文
  • 网站风格对比哪里有学计算机培训班
  • 做mla的网站网站优化哪家好
  • 网站注册的账号怎么注销线上营销活动有哪些
  • 国内做进口的电商网站网站推广软件哪个好
  • 谁有做那事的网站百度投诉中心入口
  • 免费单页网站在线制作沈阳seo排名优化教程
  • 廊坊网站建大型网站建站公司
  • 远程桌面做网站sem和seo区别与联系
  • 做贷款网站优化大师有用吗
  • 有没有便宜的网站制作制作网页教程
  • 医院网站制作优化关键词的方法有哪些
  • wordpress安装到网站吗泰安seo
  • 长春网站开发培训价格google play三件套
  • 做生存分析的网站有哪些国外新闻最新消息
  • 济南网站优化收费百度互联网营销
  • bootstrap响应网站模板下载发帖推广百度首页
  • 动态网站上的查询怎么做新媒体运营培训学校
  • 网站开发人员必备技能百度优化推广
  • 花都 网站建设百度推广怎么添加关键词
  • 开发公司成本部职责岗位职责和流程苏州网站建设优化
  • 湛江网站制作系统seo排名需要多少钱
  • 城乡现代社区建设seo关键词推广案例
  • 旅游网站开发外文文献关键洞察力
  • 大学生asp网站开发的实训周长沙百度快速优化
  • 黑龙江省建设网站百度投流运营