网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
有以下程序,输出结果()。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+i

B.2i+5

C.6+1i

D.1i+5


参考答案

更多 “ 有以下程序,输出结果()。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 ” 相关考题
考题 有以下程序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

考题 有以下程序; #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

考题 有下列程序: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)

考题 请将如下程序补充完整,使得输出结果为:bbaa。 include using naluespace std; class 请将如下程序补充完整,使得输出结果为:bbaa。include<iostream>using naluespace std;class A{public:______{eout<<"aa";}};class B:public A{public:~B( ){eont<<"bb";}};int ulain( ){B*P=new B;delete P;return 0;}

考题 有以下程序: 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

考题 有以下程序: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

考题 下面代码的输出结果是x = 12.34;print(type(x))A.<class 'bool'>B.<class 'complex'>C.<class 'float'>D.<class 'int'>