网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

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

0010<<1 == 0100

或者

0001 0011<<4 == 0011 0000

请用 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?


参考答案

更多 “ 12 一个给定的数值由左边开始升位到右边第 N 位,如00101 == 0100或者0001 00114 == 0011 0000请用 C 或者 C++或者其他 X86 上能运行的程序实现。----------------------------------------------------------------------------------------------------------------附加题(只有在完成以上题目后,才获准回答)In C++, what does "explicit" mean? what does "protected" mean?explicitC++ SpecificThis keyword is a declaration specifier that can only be applied toin-class constructor declarations. Constructors declared explicit will notbe considered for implicit conversions. For example:class X {public:explicit X(int); //legalexplicit X(double) { //legal // ... }};explicit X::X(int) {} //illegalAn explicit constructor cannot take part in implicit conversions. It canonly be used to explicitly construct an object. For example, with the classdeclared 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 implicitconversion from int to X.Note It is meaningless to apply explicit to constructors with multiplearguments, since such constructors cannot take part in implicit conversions.END C++ SpecificprotectedC++ Specific —protected: [member-list]protected base-classWhen preceding a list of class members, the protected keyword specifiesthat those members are accessible only from member functions and friends ofthe class and its derived classes. This applies to all members declared upto the next access specifier or the end of the class.When preceding the name of a base class, the protected keyword specifiesthat the public and protected members of the base class are protectedmembers of the derived class.Default access of members in a class is private. Default access of membersin a structure or union is public.Default access of a base class is private for classes and public forstructures. Unions cannot have base classes.For related information, see public, private, friend, and Table of MemberAccess Privileges.END C++ SpecificExample// Example of the protected keywordclass BaseClass {protected: int protectFunc();};class DerivedClass : public BaseClass{ public:int useProtect() { protectFunc(); } // protectFunc accessible fromderived class};void main(){BaseClass aBase;DerivedClass aDerived;aBase.protectFunc(); // Error: protectFunc not accessibleaDerived.protectFunc(); // Error: protectFunc not accessible in derivedclass } How do you code an infinite loop in C? ” 相关考题
考题 IP地址211.18.45.62用二进制表示可以写为(33)。A.1101 0011 1001 0101 1011 11110B.1101 0011 0001 00100010 1101 0011 1110C.1101 0011 1001 0000 1011 0100 1111 1000D.1101 0011 0001 00100010 11010

考题 一个10位2进制DAC在输入00 0011 0001时的输出电压为0.08V,求当输入00 1001 0011时的输出电压。

考题 阅读以下程序说明和C++程序,将程序段中(1)~(7)空缺处的语句填写完整。[说明]使用MFC的CSocket类在两个或者多个应用程序之间建立通信。服务器应用程序先创建一个特殊的 Socket,用于监听客户应用程序的连接请求,然后再创建新的Socket来完成连接。从客户和服务器两端读取该连接,直到一个需要处理的报文到来为止。以下C++程序将封装这些功能,这样所有应用程序需要完成的只是创建一个Socket连接,然后处理到来的报文。这将包括一个新的服务器Socket类、新客户端Socket类和新的报文队列类。创建新的服务器Socket类程序的框架如下。第1个函数ListenEx()用于通知Socket开始监听客户应用程序。第2个函数OnAccept()在接收到连接请求时被调用。在其中创建新的Socket,并立刻设置它开始从客户应用程序读取报文,这些是通过调用第3个函数RecvThread()来完成的,该函数位于它自己的线程中。[C++程序][ListenEX()函数]

考题 在一个C++源程序文件中定义的全局变量的有效范围是( )。A.该C++程序的所有源程序文件B.本源程序文件的全部范围C.从定义变量的位置开始到本源程序文件结束D.函数内部全部范围

考题 下面程序段的执行结果是( )。 main() {int a[5][5],i,j; for(i=1;i<5;i++) for(j=1;j<5;j++) a[i][j]=(i<j)*(j/i); for(i=1;i<5;i++) { for(j=1;j<5;j++) printf("%2d",a[i][j]); printf("\n"); } }A.1111 1111 1111 1111B.0001 0010 0100 1000C.1000 0100 0010 0001D.0000 0000 0000 0000

考题 C++程序第1条语句是从【 】函数开始执行的。

考题 阅读下列程序说明和C++程序,把应填入其中(n)处的字句,写在对应栏内。【说明】阅读下面几段C++程序回答相应问题。比较下面两段程序的优缺点。①for (i=0; i<N; i++ ){if (condition)//DoSomething…else//DoOtherthing…}②if (condition) {for (i =0; i<N; i++ )//DoSomething}else {for (i=0; i <N; i++ )//DoOtherthing…}

考题 某机器的IP地址是46.52.74.99,则它的二进制IP地址为(181),这是一个属于(182)的IP地址。A.0111 1000 0101 0010 1000 0110 1001 1001B.0000 0011 1100 1010 1010 0110 1001 1001C.0000 0010 010l 0110 1001 0111 0110 0011D.0010 1110 0011 0100 0100 1010 0110 0011

考题 阅读以下说明和C++代码。[说明]已知类SubClass的getSum方法返回其父类成员与类SubClass成员j的和,类 SuperClass中的getSum为纯虚拟函数。程序中的第23行有错误,请修改该错误并给出修改后的完整结果,然后完善程序中的空缺,分析程序运行到第15行且尚未执行第15行的语句时成员变量j的值,最后给出程序运行后的输出结果。[C++代码]

考题 一个C++程序的执行总是从( )。A.本程序的第1个函数开始,到本程序文件的最后一个函数结束B.本程序的第1个函数开始,到本程序的main()函数结束C.本程序的main()函数开始,到main()函数结束D.本程序的main()函数开始,到本程序的最后一个函数结束

考题 某32位计算机的Cache容量为16KB Cache块的大小为16B,若主存与Cache地 址映像采用直接映射方式,则主存地址1234E8F8(十六进制)装入Cache的地址是(44)。A.OO01 0001 0011 01B.0100 0100 0110 10C.I010 0011 1110 00D.1101 0011 1010 00

考题 一个C++程序的开发步骤通常包括编辑、______、链接、运行和调试。

考题 开发一个C++语言程序的步骤通常包括编辑、【 】、链接、运行和调试。

考题 ______是实现C++语言编译时多态性的机制,______是实现C++语言运行时多态性的机制。

考题 ●以下关于C语言与C++语言的叙述中,正确的是(32)。(32)A.只要将C程序的扩展名.c改为.cpp,就可将过程式的C程序转换为面向对象的C++程序B.由于C++是在C的基础上扩展的,所以C++编译器能编译C源程序C.在C程序中,也可以用结构体类型定义类D.与C不同,C++程序中的函数必须属于某个类

考题 用C++写个程序,如何判断一个操作系统是16位还是32位的?

考题 程序状态字寄存器的内容()。A、只能由程序置位给定B、不能由程序置位给定C、只能由运行结果置定D、既能由运行结果置位,也能由程序置位

考题 Android应用程序结构是()A、Linux Kernel(Linux内核)B、Libraries(系统运行库或者是c/c++核心库)C、ApplicationFramework(开发框架包)D、Applications(核心应用程序)

考题 LDA、ADD和SUB三条助记符对应的操作码分别为()A、0000、0001和0010B、0001、0000和0100C、1110、1111和0010D、0000、1101和0101

考题 项目对应科目关系时的操作是()。A、全部由系统自动对应B、由左边项目托到右边科目上C、由右边科目拖到左边项目上D、由右边科目双击到左边项目上

考题 在C++中,使用类体系依靠什么机制实现程序运行时的多态?

考题 (64)10表示的二进制数为()。A、0100 0000B、1000 0000C、0011 1111D、0111 1111

考题 问答题用C++写个程序,如何判断一个操作系统是16位还是32位的?

考题 单选题项目对应科目关系时的操作是()。A 全部由系统自动对应B 由左边项目托到右边科目上C 由右边科目拖到左边项目上D 由右边科目双击到左边项目上

考题 单选题程序状态字寄存器的内容()。A 只能由程序置位给定B 不能由程序置位给定C 只能由运行结果置定D 既能由运行结果置位,也能由程序置位

考题 多选题Android应用程序结构是()ALinux Kernel(Linux内核)BLibraries(系统运行库或者是c/c++核心库)CApplicationFramework(开发框架包)DApplications(核心应用程序)

考题 单选题在开发一个C++程序的整个过程中,第3个步骤为(  )。A 链接B 运行C 编辑D 编译