填空题
有以下复数类的声明,请补充完整。
Class complex
double real;//实部
double imag;//虚部
public:
complex(double x,double y)
real=x:
imag=y;
complex operator+(complex e) //重载加法运算符“+”
return complex(______)
;
【参考答案】
real+c.real,imag+c.imag
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
已知类sample是一个抽象类,其成员函数display是无形参、无返回类型的纯虚函数,请完成其声明: sample public: sample( ) ; ______ ;
点击查看答案&解析
填空题
已知如下程序的输出结果是23,请将画线处缺失的部分补充完整。 #include<iostream> using namespace std; class MyClass public: void Print( )consteout<<23; ; int main( ) MyClass*P=new MyClass( ); ______.Print( ); return 0;
点击查看答案&解析
相关试题
请将下列栈类Stack补充完整。 class Stac...
请在如下程序中的空格处填写正确的语句; ...
请将如下程序补充完整,使得输出结果为:bb...