有以下程序: include using namespace std; class Complex{public: Complex(double 有以下程序: #include <iostream> using namespace std; class Complex { public: Complex(double r=0,double i=0):re(r),im(i){ double zeal() const {return re;} double imag() const {return im;} Complex operator+(Complex c) const { return Complex(re+c.re,im+c.im);} private: double re,im; }; int main() Complex a=Complex(1,1)+Complex(5); cout<<a.real()<<'+'<<a.imag()<<'i'<<end 1; return 0; }程序执行后的输出结果是______。A.6+6iB.6+1iC.1+6iD.1+1i

有以下程序: include using namespace std; class Complex{public: Complex(double

有以下程序: #include <iostream> using namespace std; class Complex { public: Complex(double r=0,double i=0):re(r),im(i){ double zeal() const {return re;} double imag() const {return im;} Complex operator+(Complex c) const { return Complex(re+c.re,im+c.im);} private: double re,im; }; int main() Complex a=Complex(1,1)+Complex(5); cout<<a.real()<<'+'<<a.imag()<<'i'<<end 1; return 0; }程序执行后的输出结果是______。

A.6+6i

B.6+1i

C.1+6i

D.1+1i


相关考题:

有以下程序include using namespace std;class Complex{public: Complex(double r=O, 有以下程序 #include<iostream> using namespace std; class Complex { public: Complex(double r=O,double i=0):re(r),im(i){} double real() const {return re;} double imag()const {return im;} Complex operator +(Complex C) const {return Complex (re+c.re,im+c.im);} private: double re,im; }; int main() { Complex a=Complex(1,1)+Complex (5); cout<<a.real()<<'+'<<a.imag()<<'i'<<endl; retum 0; } 程序执行后的输出结果是A.6+6iB.6+1iC.1+6iD.1+1i

有以下程序include using namespacestd;class Complex{public:Complex (doubler=0, d 有以下程序 #include <iostream> using namespace std; class Complex { public: Complex (double r=0, double i =0 :re(r) ,im (i) {} double real() const {return re;} double imag() const { return im;} Complex operator + (Complex c} const {return Complex(re+c.re, im+c.im);} privane: double re,im; }; int main { Complex a =Complex (1,1)+Complex(5); cout<<a.real()<<'+'<<a.imag() << 'i' <<endl return 0; } 程序执行后的输出结果是A.6+6iB.6+1iC.1+6iD.1+1i

有以下程序include using namespace std;class Complex{public:Complex(double r=0,d 有以下程序#include <iostream>using namespace std;class Complex{public: Complex(double r=0,double i=0):re(r),im(i){ double real() const {return re;} double imag() const { return im; } Complex operator+(Complex c) const {return Complex(re+c.re,im+c.im);}private: double re,im;};int main(){ Complex a =Complex(1,1)+ Complex(5); cout<<a.real()<<'+'<<a.imag()<<'i'<<end1; retura 0;}A.6+6iB.6+1iC.1+6iD.1+1i

有以下程序,输出结果()。includeusing namespace std;class Complex{public:Complex(d 有以下程序,输出结果( )。 #include<iostream> using namespace std; class Complex { public: Complex(double r=0,double i=0):re(r),im(i){} double real()const{return re;} double imagoconst{return im;} Complex operator+(Complex C) const {return Complex(re+c.re,im+c.im);} private: double re,im; }; int main() { Complex a=Complex(1,1)+Complex(5); cout<<a.real()<<'+'<<a.imag()<<'i'<<end1; return 0; }A.6+iB.2i+5C.6+1iD.1i+5

有以下程序; #includeiostream usingnamespacestd; classComplex { public: Complex(doubler=0,doublei=O):re(r),im(i){} doublereal()const{returnre;} doubleimag()const{returnim;} Complexoperator+(Complexc)const {returnComplex(re+C.re,im+C.im);} private: doublere,im; }; intmain() { Complexa=Complex(1,1)+Complex(5); couta.real()+a.imag()iendl; return0; } 程序执行后的输出结果是( )。A.6+6iB.6+1iC.1+6iD.1+1i

有以下程序:includeincludeusing namespace std; class point{private:double 有以下程序: #include<iostream> #include<math> using namespace std; class point { private: double x; double y; public: point(double a,double B) { x=a; y=b; } friend double distance (point a,point B) ;A.1B.5C.4D.6

有下列程序:includeusing namespace std;class Complex{double re,im;public:Complex 有下列程序: #include<iostream> using namespace std; class Complex { double re,im; public: Complex(double r,double i):re(r),im(i){} double real()const{retum re;} double image()const{return im;} Complex operator+=(Complex A) { rA.(1,-2)B.(2,3)C.(3,5)D.(3,1)

有以下程序:includeusing namespace std;class Complex{public:Complex(dOuble r=0,d 有以下程序: #include<iostream> using namespace std; class Complex { public: Complex(dOuble r=0,dOuble i=0):re(r),im(i){} doublereal()const{return re;} doubleimag()const{return im;} Complex operator+(Complex c)const {return ComplexA.6+6iB.6+1iC.1+6iD.1+1i

阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。【C++代码】#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}