单项选择题
下列叙述中正确的是______。
A.循环队列有队头和队尾两个指针,因此,循环队列是非线性结构
B.在循环队列中,只需要队头指针就能反映队列中元素的动态变化情况
C.在循环队列中,只需要队尾指针就能反映队列中元素的动态变化情况
D.循环队列中元素的个数是由队头指针和队尾指针共同决定
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
问答题
请使用VC6或使用[答题]菜单打开考生文件夹proj3下的工程文件proj3,此工程中包含一个源程序文件proj3.cpp,其中定义了用于表示平面坐标系中的点的类MyPoint和表示矩形的类MyRectangle;程序应当显示: (0,2)(2,2)(2,0)(0,0)4 但程序中有缺失部分,请按照以下提示,把缺失部分补充完整: (1)在“ **1** ****found****”的下方是构造函数的定义,它用参数提供的左上角和右下角的坐标对up_left和down_right进行初始化。 (2)在“**2** ****found****”的下方是成员函数getDownLeft的定义中的一条语句。函数getDownLeft返回用MyPoint对象表示的矩形的左下角。 (3)在” **3** ****found****”的下方是成员函数area的定义,它返回矩形的面积。 注意:只在指定位置编写适当代码,不要改动程序中的其他内容,也不要删除或移动“****found****”。 proj3.cpp #include<iostream> using namespace std; class MyPoint 表示平面坐标系中的点的类 double x; double y; public: MyPoint (double x,double y)this->x=x;this->y=y; double getX()constreturn x; double getY()constreturn y; void show()constcout<<’(’<<x<<’,’<<y<<’)’; ); class MyRectangle 表示矩形的类 MyPoint up_left; 矩形的左上角顶点 MyPoint down_right; 矩形的右下角顶点 public: MyRectangle (MyPoint upleft, MyPoint downright); MyPoint getUpLeft () const returnup_left; 返回左上角坐标 MyPoint getDownRight () const return down_right; 返回右下角坐标 MyPoint getUpRight () const; 返回右上角坐标 MyPoint getDownLeft () const; 返回左下角坐标 double area () const; 返回矩形的面积; **1** **********found********** MyRectangle::MyRectangle(______): up_left(p1),down_right(p2) MyPoint MyRectangle:: getUpRight()const return MyPoint(down_right.getX (),up_left.getY(); MyPoint MyRectangle:: getDownLeft()const **2** **********found********** return MyPoint(______); **3** **********found**********______ area () const return (getUpLeft ().getX()-get-DownRight().getX())*(getDownRight().getY()-getUpLeft().getY()); int main ( ) MyRectangle r (MyPoint (0,2),MyPoint(2,0)); r.getUpLeft().show(); r.getUpRight().show(); r.getDownRight().show(); r.getDownLeft().show(); cout<<r.area()<<endl; return 0;
点击查看答案&解析
问答题
请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1,此工程中含有一个源程序文件proj1.cpp。其中位于每个注释“ ERROR****found****”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为: Constructor called. The value is 10 Max number is 20 Destructor called. 注意:只能修改注释“ ERROR****found****”的下一行语句,不要改动程序中的其他内容。 proj1.cpp #include <iostream> using namespace std; class MyClass public: ERROR**********found********** void MyClass(int i) value=i;cout<< Constructorcalled. <<endl; int Max(int x,int y)return x>yx:y; 求两Ai整数的最大值 ERROR**********found********** int Max(int x,int y,int z=0) 求三个整数的最大值 if(x>y) return x>zx:z; else return y>zy:z; int GetValue()constreturn value; ~MyClass()cout<< Destructorcalled. <<endl; private: int value; ; int main () MyClass obj(10); cout<< The value is <<value()<<endl; cout<< Max number is <<obj.Max(10,20)<<endl; return 0;
点击查看答案&解析
相关试题
请使用VC6或使用[答题]菜单打开考生文件...
请使用VC6或使用[答题]菜单打开考生文件...
请使用VC6或使用[答题]菜单打开考生文件...
下列关于C++流的描述中,错误的是___...
在下列枚举符号中,用来表示“相对于当前位...