有以下程序#include <iostream>using namespace std;class Complex{public: Complex(double r=0,double i=0):re(r),im(i){ double real(

admin2009-01-15  23

问题 有以下程序#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+6i
B、6+1i
C、1+6i
D、1+1i

答案2

解析
转载请注明原文地址:https://kaotiyun.com/show/S3kp777K
0

最新回复(0)