单选题下列关于this指针的描述中,正确的是______。
单选题若有下列定义及初始化语句: int i=100; int*p= intk=*ip; 并假设整型数i的地址为0x12345678,指针中的地址为0x21000000,则k的值为( )。
单选题有如下程序: #include<iostream> using namespace std; class TestClass public: TestClass(int r1,int r2) R1=r1; R2=r2; void print(); void print()const; private: int R1,R2; ; void TestClass::print() cout<<R 1 <<","<<R2<<end1; void YestClass::print()const cout<<R1 <<","<<R2<<end1; int main() TestClass a(5,4); const TestClass b(20,52); b.print(); return 0; 执行后的输出结果是( )。 A) 5,4 B) 20,52 C) 0,0 D) 4,5
单选题派生类对象对其基类中的什么成员是可访问的?
单选题以下程序的输出结果是 #include<iostream.h> void main( ) { char x=040; cout << (X<<1) ;}
单选题有如下程序:
#include<iostream>
using namespace std;
class A{
public:
static int a;
void init(){a=1;}
A(int a=2){init();a++;}
};
int A::a=0;
A obj;
int main()
{
cout<<obj.a;
return 0;
}
运行时输出的结果是______。
单选题下面程序段中,for循环的执行次数是 char * s=“/ta/018bc"; for(;* s! ='/0';s++)cout < < " * ";
单选题有以下程序: #include <iostream> #include <string> using namespace std; int main () { char s[]="/n123//"; cout<<strlen (s) <<", "<<sizeof (s) <<end1; return 0; }
单选题下列程序的输出结果是 #include<iostream.h> class Myclass public:My class(inti=0,int j=0) x=i; y=j; void show()cout<<"x=" <<x<<" " <"y=" <<y<<endl; void show()constcout<<"x="<<""<<"y="<<y<<endl; privated: int x; int y; ; void main() Myclassmy1(3,4); const my2(7,8); myl.show();my2.show();
单选题下列说法中错误的是
单选题对下面程序描述正确的是( )。 #include < iostream > using namespace std; class A private: int i; public: class B private: int j; protected: int k; int fun1 ( ); MyB; int fun2 ( );
单选题若有以下的定义, int a[ ]={1,2,3,4,5,6,7,8,9,10},*p=a;则值为3的表达式是 ______。
单选题有如下类定义: c1ass Test{ char a;const charb; public: Test(charc){a=c;b=c;}//第1行 void f(char a)const {this—>a=a;) //第2行 void g(charb){this—>b=b;} //第3行 char ho const{return a;} //第4行 }; 编译时没有错误的行是( )。
单选题下列关于 C++ 流的叙述中,正确的是
单选题有如下程序段: int i=5; while(int i=0){cout<<'*';i--;} 运行时输出''*''的个数是( )。
单选题若有下面的函数调用:fun(a+b,3,max(n-1,b))则fun的实参个数是( )。
单选题下列函数原型声明中,错误的是( )。
单选题有如下类的定义,横线处的语句是( )。 class TestClass ______ int x,y; public: TestClass (int a=0,int b=0) x=a; y=b; static void change() y-=10; y-=10; ; A) public B) private C) static D) protected
单选题使用ifstream流类定义流对象并打开磁盘文件时,文件的隐含打开方式为______。
单选题有如下程序: #include<iostream> using namespace std; class Test public: Test() n+=2; ~Test() n-=3; static int getNum()return n; private: static int n; ; int Test::n=1; int main() Test*p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; 执行后的输出结果是( )。
