单选题下列程序的运行结果是 #include<iostream.h> class Location private: int X.Y; public: void init(int=0,int=0); void valueX(int val)X=val; int valueX( ) return X; void valueY(int val)Y=val; int valueY( )return Y;; void Location::init(int init X,int init Y) X=initX; Y=initY; void main( ) Location A,B; A.init( ); A.valueX(5); cout<<A.valueX( )<<endl<<A.valueY( )<<endl; B.init(6,2); B.valueY(4); cout<<B.valueX( )<<endl<<B.valueY( )<<endl;
单选题若有如下程序: #include<iostream> using namespace std; class A public: A(int i,int j) a=i; b=j; void move(int x,int y) a+=x; b+=y; void show() cout<<a<<","<<b<<end1; private: int a,b; ; class B:private A public: B(int i,int j):A(i,j) void fun() move(3,5); void f1() A::show(); ; int main() B d(3,4); d.fun(); d.f1(); return 0; 程序执行后的输出结果是( )。
单选题下列关于圆括号运算符的功能说法不正确的是 ______。
单选题下列叙述中正确的是
单选题有如下程序:
#include
#include
using namespace std;
class MyBag{
public:
MyBag(string br,string cr):brand(br),color(cr) { ++count; }
~MyBag() { --count; }
static int GetCount() { return count; }
private:
string brand,color;
static int count;
};
_____________________
int main(){
MyBag one("CityLife","Gray"),two("Micky","Red");
cout<
单选题有如下说明:
int a[10]={1,2,3,4,5,6,7,8,9,10},*p=a;
则数值为9的表达式是______。
单选题Sample是一个类,执行下面语句后,调用Sample类的构造函数的次数是,( )。 Sample a[2],*P=new Sample;
单选题有如下程序:
#include<iostream>
using namespace std;
class A
{
public:
A(int i){x=i;}
void dispa(){cout<<x<<",";}
private:
int x;
};
class B:public A
{
public:
B(int i):A(i+10){x=i;}
void dispb(){dispa();cout<<x<<endl;}
private
int x;
};
int main()
{
B b(2);
b.dispb();
return 0;
}
运行时输出的结果是______。
单选题若某完全二叉树的深度为h,则该完全二叉树中至少有 ______ 个结点。
单选题下列关于C++流的描述中,错误的是( )。
单选题N610060099) 有如下程序:
#include
#include
using namespace std;
class MyBag{
public:
MyBag(string br,string cr):brand(br),color(cr) { cout<<++count; }
~MyBag() { --count; }
static int GetCount() { return count; }
private:
string brand,color;
static int count;
};
int MyBag::count=0;
int main() {
MyBag one("CityLife","Gray"),two("Micky","Red");
MyBag *ptr=new MyBag("Coach","Black");
delete ptr;
cout<
单选题有如下语句序列: char str[10];cin>>str;
当从键盘输入"I love this game"时,str中的字符串是
A. "I love this game"
B. "I love this"
C. "I love"
D. "I"
单选题有如下程序: #include<iostream> using namespace std; class Goods{//货物类 double unit_price;//单价 int quantity;//数量 public: Goods(double u=0.0,int q=0):unit_price(u),quantity(q){} double getPrice()const{return unit_price;}//返回单价 int getQuantity()const{return quantity;}//返回数量 //增加数量 Goods operator+(int q)const{return Goods(unit_price,quantity+q);} }; //增加数量 Goods operator+(________){return g+q;} //输出货物信息 ostream&operator<<(ostream& os,Goods g){ cout<<"单价:"<<g.getPrice()<<','<<”数量:"<<g.getQuantity()<<endl; return os; }; int main(){ Goods g(35.6,100); cout<<g<<g+33<<25+g; return 0; } 若运行后的输出结果是: 单价:35.6,数量:100 单价:35.6,数量:133 单价:35.6,数量:125 则程序中下划线处缺失部分应该是( )。
单选题在int a=3, int, p= 中,p的值是
单选题下列关于栈叙述正确的是
____
。
单选题下列关于运算符重载的叙述中,正确的是
A.通过运算符重载,可以定义新的运算符
B.有的运算符只能作为成员函数重载
C.若重载运算符+,则相应的运算符函数名是+
D.重载一个二元运算符时,必须声明两个形参
单选题下列叙述中正确的是______。
单选题关于纯虚函数,下列表述中正确的是______。
单选题有如下类的定义。应在空格处填入的语句是 ( )。 class MyClass ______________ int x, y; public: MyClass(int a=0,int b=0) x=a; y=b; static void change) x-=10; y-=10; ; A) static B) const C) mutable D) 不需要填入内容
单选题一般情况下,当对关系R和S进行自然连接时,要求R和S含有一个或者多个共有的( )。
