有如下类声明:
class Base{
protected:
int amount;
public:
Base(int n=0):amount(n){}
int getAmountconst{retum amount;}
};
class Derived:public Base{
protected:
int value;
public:
Derived(int m,int n):value(m),Base(n){}
int getDataconst{return value+amount;}
}:
已知x是一个Derived对象,则下列表达式中正确的是( )。
若有以下程序:
#include <iostream>
using namespace std;
class Base
{
public:
void who(){cout<<" Base"<<end1:}
};
class Derived1: public Base
{
public:
void who(){ cout<<"Derived"<<end1;}
};
int main()
{
Base *p;
Derived1 obj1;
p=&obj1;
p->who();
return 0;
}
则该程序运行后的输出结果是【 】。
下列程序的输出结果是______。
#include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}
有以下程序:
#include <iostream>
using namespace std;
class CFactorial
{
private:
int value;
int fact;
public:
CFactorial ( int val );
void CalculateFactorial();
void Display();
};
CFactorial :: CFactorial( int val )
{
value = val;
fact = 1;
}
void CFactorial :: CalculateFactorial()
{
int i = value;
while ( i > 1 )
fact *= i--;
}
void CFactorial :: Display()
{
cout<<value<<"!="<<fact<<end1;
}
int main()
{
CFactorial A( 5 );
A.CalculateFactorial();
A.Display();
return 0;
}
程序中,类CPactorial的功能是【 】,该程序运行的结果是【 】。
以下程序输出的结果是【 】。
#include<iostream.h>
void main( )
{
int a=5,b=4,c=3,d;
d=(a>b>C) ;
cout<<d;
}
若已定义: int a[ ]={0,1,2,3,4,5,6,7,8,9},*p=a,i; 其中0≤i≤9,则对a数组元素不正确的引用是
有以下程序段: int k=0; while(k=1)k++; while循环执行的次数是( )。
在C++语言中,打开一个文件就是将这个文件与一个什么建立关联?
关于类和对象描述错误的是
下列字符串中可以用作C++标识符的是( )。
有如下类声明:
class Base{
protected:
int amount;
public:
Base(int n=0):amount(n){}
int getAmountconst{retum amount;}
};
class Derived:public Base{
protected:
int value;
public:
Derived(int m,int n):value(m),Base(n){}
int getDataconst{return value+amount;}
}:
已知x是一个Derived对象,则下列表达式中正确的是( )。
高级经济师考试试题精选练习(1)
高级经济师考试模拟练习题之单选题(1
高级经济师考试试题精选练习(2)
高级经济师考试试题精选练习(3)
高级经济师考试试题:经济法案例试题精
高级经济师考试模拟试题及答案
高级经济师考试试题及答案:单选练习题
高级经济师考试试题:经济法案例试题精
高级经济师考试模拟题及答案练习(1)
高级经济师考试模拟题及答案练习(2)