当前位置: 首页 > 其他类 > 问题详情
问题

12 一个给定的数值由左边开始升位到右边第 N 位 如 0010$amp;<amp;$lt;1 == 0100 或者 0001 0011$amp;<amp;$l

12 一个给定的数值由左边开始升位到右边第 N 位,如

0010$amp;或者

0001 0011$amp;请用 C 或者 C++或者其他 X86 上能运行的程序实现。

-----------------------------------------------------------------------------

-----------------------------------

附加题(只有在完成以上题目后,才获准回答)

In C++, what does "explicit" mean? what does "protected" mean?

explicit

C++ Specific

This keyword is a declaration specifier that can only be applied to

in-class constructor declarations. Constructors declared explicit will not

be considered for implicit conversions. For example:

class X {

public:

explicit X(int); //legal

explicit X(double) { //legal // ... }

};

explicit X::X(int) {} //illegal

An explicit constructor cannot take part in implicit conversions. It can

only be used to explicitly construct an object. For example, with the class

declared above:

void f(X) {}

void g(int I)

{

f(i); // will cause error

}

void h()

{

X x1(1); // legal

}

The function call f(i) fails because there is no available implicit

conversion from int to X.

Note It is meaningless to apply explicit to constructors with multiple

arguments, since such constructors cannot take part in implicit conversions.

END C++ Specific

protected

C++ Specific —>

protected: [member-list]

protected base-class

When preceding a list of class members, the protected keyword specifies

that those members are accessible only from member functions and friends of

the class and its derived classes. This applies to all members declared up

to the next access specifier or the end of the class.

When preceding the name of a base class, the protected keyword specifies

that the public and protected members of the base class are protected

members of the derived class.

Default access of members in a class is private. Default access of members

in a structure or union is public.

Default access of a base class is private for classes and public for

structures. Unions cannot have base classes.

For related information, see public, private, friend, and Table of Member

Access Privileges.

END C++ Specific

Example

// Example of the protected keyword

class BaseClass {

protected: int protectFunc();

};

class DerivedClass : public BaseClass

{ public:

int useProtect() { protectFunc(); } // protectFunc accessible from

derived class

};

void main()

{

BaseClass aBase;

DerivedClass aDerived;

aBase.protectFunc(); // Error: protectFunc not accessible

aDerived.protectFunc(); // Error: protectFunc not accessible in derived

class } How do you code an infinite loop in C?

请帮忙给出正确答案和分析,谢谢!

发布时间:2018-05-23
参考答案

正确答案:

相关问题
  • 矿物的比重和密度在数值上是相等的。()

    矿物的比重和密度在数值上是相等的。()

    答案解析
  • 绿色GDP是指从GDP中扣除自然资源耗减和环境污染后的GDP数值 引

    绿色GDP是指从GDP中扣除自然资源耗减和环境污染后的GDP数值,引入“绿色GDP”概念的主要目的是()。A 使人们不再关心经济的单一速度指标B 促进产业结构调

    答案解析
  • 皮肤潮湿按电力开关掣时 会比干爽时有较大触电危险 原因是人体

    A、电容B、电压C、电阻请帮忙给出正确答案和分析,谢谢!

    答案解析
  • 某企业测量各单位缺勤率分别为1 2% 0.8% 2.1% … 请问这些

    某企业测量各单位缺勤率分别为1,2%,0 8%,2 1%,…,请问这些属于什么数据()。A 计量值B 计数值

    答案解析
  • “勒克斯”是衡量哪种数值的计量单位?

    “勒克斯”是衡量哪种数值的计量单位?

    答案解析
  • 哪一个数值的血压属于正常血压() A.120/80 B.140/90 C.120

    哪一个数值的血压属于正常血压()A 120 80B 140 90C 120 95D 180 120

    答案解析
  • 用户输入M N值 从1至N开始顺序循环数数 每数到M输出该数值

    用户输入M,N值,从1至N开始顺序循环数数,每数到M输出该数值,直至全部输出。写出C程序。

    答案解析
  • 用户输入M N值 从1至N开始顺序循环数数 每数到M输出该数值

    用户输入M,N值,从1至N开始顺序循环数数,每数到M输出该数值,直至全部输出。写出C程序。

    答案解析
  • 某文件的权限为:drw-r--r-- 用数值形式表示该权限 则该

    某文件的权限为:drw-r--r--,用数值形式表示该权限,则该八进制数为: 644 ,该文件属性是 。

    答案解析
  • 某文件的权限为:drw-r--r-- 用数值形式表示该权限 则该

    某文件的权限为:drw-r--r--,用数值形式表示该权限,则该八进制数为: 644 ,该文件属性是 。

    答案解析

最新问题

Copyright © 2016-2023 114题库网(114158.com)All Rights Reserved.  免责声明 豫ICP备19007809号-5